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. MVC之前的那点事儿系列

    MVC之前的那点事儿系列,是笔者在2012年初阅读MVC3源码的时候整理的,主要讲述的是从HTTP请求道进入MVCHandler之前的内容,包括了原创,翻译,转载,整理等各类型文章,当然也参考了博客园 ...

  2. C#--异步显示工作进度

    耗时的操作在长时间运行时可能导致用户界面停止响应,这时需要把操作转移到单独的线程上运行,保证当前用户界面可以继续流畅交互,同时还需要实时了解独立线程上的任务进度.可以使用BackgroudWorker ...

  3. Windows Server 2012 配置多用户远程桌面

    前段时间因为需要多用户同时远程连接 windows server 2012,但找了半天也没找到远程桌面管理,最后从搜索中找到如下方法,经测试可行! 打开注册表,进入路径: [HKEY_LOCAL_MA ...

  4. Spring、mybaits整合

    mybatis.cfg.xml <!DOCTYPE configuration PUBLIC "-//mybatis.org/DTD Config 3.0//EN" &quo ...

  5. HDU 4745---Two Rabbits(区间DP)

    题目链接 http://acm.split.hdu.edu.cn/showproblem.php?pid=4745 题意:两只兔子,在n块围成一个环形的石头上跳跃,每块石头有一个权值ai,一只从左往右 ...

  6. Statement和PreparedStatement的区别; 什么是SQL注入,怎么防止SQL注入?

    问题一:Statement和PreparedStatement的区别 先来说说,什么是java中的Statement:Statement是java执行数据库操作的一个重要方法,用于在已经建立数据库连接 ...

  7. 【USACO】DP动态规划小测(一)

    {20160927 19:30~21:30} 总分400分,我113.33,稳稳地垫底了......(十分呼应我上面的博客名,hhh~)过了这么多天我才打完所有代码,废话我也就不多说了.不过,虽然时间 ...

  8. Lucene.net站内搜索—3、最简单搜索引擎代码

    目录 Lucene.net站内搜索—1.SEO优化 Lucene.net站内搜索—2.Lucene.Net简介和分词Lucene.net站内搜索—3.最简单搜索引擎代码Lucene.net站内搜索—4 ...

  9. C# Unicode编码

    为了避免在浏览器中传输数据的时候出现中文乱码,我们可以将内容进行URL编码,当然也可以将内容进行UNICODE编码.将汉字进行UNICODE编码,如:"王"编码后就成了" ...

  10. .NET删除字节数组中的0字节

    private static byte[] Decode(byte[] packet) { ; while (packet[i] == 0) { --i; } ]; Array.Copy(packet ...