1  屏幕触控实现(单击 双击)

  [self becomeFirstResponder];
//允许多点互动
self.view.multipleTouchEnabled=TRUE;

实现事件部分

#pragma mark-
#pragma mark touch - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{ //触摸开始 } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{ //移动 } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
//结束
UITouch *atouch=[touches anyObject];
if(atouch.tapCount>=)
{
//双击
}
else if(atouch.tapCount==)
{ //单击
}
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{ }

2 手势识别(UIlabel 点击事件实现)

  //设置图片的点击事件
UITapGestureRecognizer *recongnizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTapFrom:)];
recongnizer.numberOfTapsRequired=;
self.img.userInteractionEnabled=YES;
[self.img addGestureRecognizer:recongnizer];
} -(void)handleTapFrom:(UITapGestureRecognizer *)recognizer{
[self updateDisplayValuesWithTip:@"tap" tapCount: touchCount:];
}
 

3 屏幕晃动实现

//AppDelegate 中实现
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
application.applicationSupportsShakeToEdit = YES;
} //或者代码中实现
[[UIApplication sharedApplication] setApplicationSupportsShakeToEdit:YES]; //ViewController 中实现下面方法 - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0);
{ }
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0)
{
if (event.subtype == UIEventSubtypeMotionShake) { //摇一摇 行为 }
}
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0)
{ }

4 图片滑动换页

UISwipeGestureRecognizer *recognizer;
self.img.userInteractionEnabled=YES;
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
[[self img] addGestureRecognizer:recognizer]; }
-(void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer {
NSLog(@"Swipe received."); if (recognizer.direction==UISwipeGestureRecognizerDirectionRight) {
NSLog(@"swipe down");
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
//界面变化部分
//........ [UIView commitAnimations];
}
}

(ios) 屏幕触摸总结的更多相关文章

  1. iOS中—触摸事件详解及使用

    iOS中--触摸事件详解及使用 (一)初识 要想学好触摸事件,这第一部分的基础理论是必须要学会的,希望大家可以耐心看完. 1.基本概念: 触摸事件 是iOS事件中的一种事件类型,在iOS中按照事件划分 ...

  2. iOS的触摸事件的用法以及和手势识别器的区别

    1.首先来介绍下触摸事件和手势识别器的利与弊 触摸事件和手势识别器二者之间有直接的关系 手势识别器是在触摸事件的基础上演变过来的 当我们用到触摸事件时 默认的uiview是没有什么效果的 只能自定义v ...

  3. iOS屏幕适配

    ## iOS屏幕适配 ### iOS屏幕适配发展史 1> iPhone4以前(没有iPad) * 不需要屏幕适配 2> iPad.iPhone5等设备出现 * 需要做横竖屏适配 * aut ...

  4. Auto Layout 在iOS屏幕适配中的使用

    前几天在做iOS屏幕的适配,也就是让同样的UI控件的布局在不同屏幕的iOS设备上面都正确显示,storyBoard就无可避免的用到了Auto Layout.在这个过程中,我发现要熟练掌握Auto La ...

  5. iOS屏幕尺寸和分辨率

    iOS平台家族成员主要包括iPhone.iPod Touch和iPad,但是各类设备的分辨率各不相同,目前存在的尺寸主要有: iOS设备的尺寸多种多样,此外,屏幕的分辨率也有多种,总结如下表所示: 其 ...

  6. 【转】iOS屏幕适配

    一.iOS屏幕适配发展历程 设备 适配技术 4及以前(iPad未出) 直接用代码计算 有了iPad autoResizing 有不同屏幕的iPhone后 autoLayout 有更多不同屏幕的iPho ...

  7. Windows Phone中使用Storyboard做类似 IOS 屏幕小白点的效果

    windows phone中做动画其实很方便的,可以使用Blend拖来拖去就做出一个简单的动画,下面做了一个 ios屏幕小白点的拖动效果,包括速度判断移动 使用Blend生成以下代码 <Stor ...

  8. iOS屏幕旋转 浅析

    一.两种orientation 了解屏幕旋转首先需要区分两种orientation 1.device orientation 设备的物理方向,由类型UIDeviceOrientation表示,当前设备 ...

  9. iOS屏幕适配-iOS笔记

    学习目标 1.[了解]屏幕适配的发展史 2.[了解]autoResizing基本用法 3.[掌握]autoLayout 的基本用法 4.[掌握]autoLayout代码实现 5.[理解]sizeCla ...

随机推荐

  1. easyui-layout 布局自适应

    最近在把以前写的一个项目改成用easyui做前端.过程中遇到了不少问.其中一个就是datagrid不能很好的布.想了好多办法都有局限.最后想到会不会是布局的问题,经过实,最后问题解. 1:比如在项目中 ...

  2. Internet 信息服务承载说明

    若要运行由 Internet 信息服务 (IIS) 承载的示例,必须确保 IIS 已正确安装且正在运行. 在 Windows Server 2008 R2 上安装 IIS 7.5 版 在"服 ...

  3. 百度云推送-服务端 C# SDK

    思路: 1.公司有项目需要做android和ios手机端推送消息的功能: 2.没有接触过这方面的知识,一头雾水,开始在网上一顿搜,网上倒是有不少解决方案,首先搜的是android的解决方案,因为ios ...

  4. 展示 Popup 的使用方法

    源码下载:[原创]展示Popup的使用方法.zip

  5. 【转】持久化消息队列之MEMCACHEQ

    G MEMCACHEQ AS MESSAGE QUEUE PHP,消息队列,MEMCACHEQ 使用消息队列(MESSAGE QUEUE)可以把某些耗时的工作推后,然后在后台慢慢地去执行,这样就不会让 ...

  6. Appcelerator Titanium Studio: JNI_CreateJavaVM missing error

    Mac升级到Yosemite后,Titanium Studio启动不了,报Appcelerator Studio: JNI_CreateJavaVM missing error 之类的错误,重装了Or ...

  7. python常用工具小函数-字符类型转换

    Python3有两种表示字符序列的类型:bytes和str.前者的实例包含原始的8位值就是的字节,每个字节有8个二进制位:后者的实例包含Unicode字符.把Unicode字符转成二进制数据最常见的编 ...

  8. 解决 WinXP下 libcurl.dll 无法定位程序输入点GetTickCount64问题

    1. 问题描述 用 IDA 打开libcurl.dll 可以在导入表看到对 GetTickCount64的引用,在 xp 的kernel32.dll中没有 GetTickCount64, 所以会出现  ...

  9. lodash链式使用

    chain var _ = require('lodash'); var user1 = { name: 'zhangsan', height: 180, weight: 120 }; var use ...

  10. lodash常用方法2--修改

    1.map function timesThree(n) { return n * 3; } _.map([1, 2], timesThree); // => [3, 6] 2.remove 移 ...