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. 创建Oracle数据库

    [root@localhost ~]# su - oracle [oracle@localhost ~]$ sqlplus /nolog SQL> conn /as sysdba; SQL> ...

  2. Monotype推出基于HTML5的Web字体平台

    著名字体公司Monotype近日宣布推出基于HTML5的Web字体平台,设计者可以访问近10万字体的目录. Monotype推出基于HTML5的Web字体平台 Monotype推出基于HTML5的We ...

  3. struts2、jsp的简单路径的简单拦截

    <filter> <filter-name>UsersFilter</filter-name> <filter-class>com.web.UsersF ...

  4. Gym 101102C---Bored Judge(区间最大值)

    题目链接 http://codeforces.com/gym/101102/problem/C problem description Judge Bahosain was bored at ACM ...

  5. 理解Ruby中的作用域

    作用域对于Ruby以及其它编程语言都是一个需要理解的至关重要的基础知识.在我刚开始学习ruby的时候遇到很多诸如变量未定义.变量没有正确赋值之类的问题,归根结底是因为自己对于ruby作用域的了解不够, ...

  6. MAC 卸载 mysql

    怎样才能完全卸载mysql和删除它从你的Mac(包括所有数据库)执行以下操作: 打开终端窗口 使用mysqldump备份你的数据库将文本文件! 停止数据库服务器 sudo rm /usr/local/ ...

  7. ABAP可以提高效率的小语法

    ADD dobj1 TO dobj2. Effect This statement has the same effect as the statement COMPUTE dobj2 = dobj2 ...

  8. 规划SharePoint2010的管理员密码更改

    规划自动密码更改 (SharePoint Server 2010) 为了简化密码管理,自动密码更改功能允许您更新和部署密码,而不必在多个帐户.服务和 Web 应用程序之间执行手动密码更新任务.您可以配 ...

  9. ArcGIS中国工具2.2正式发布

    ArcGIS中国工具2.2新功能 1. 2.0全面支持ArcGIS10.3 2. 全面修改成插件,原来部分是独立运行的EXE 3. 可以制作倾斜的矩形图框 4. 修改宗地(地块)左上角为第一个点,填写 ...

  10. wydomain

    目标系统信息收集组件,完全模块化,脚本均可拆可并.可合可分的使用! 运行流程 利用FOFA插件获取兄弟域名,并透视获取到的子域名相关二级域名.IP信息 检查域名和兄弟域名是否存在域传送漏洞,存在就遍历 ...