IOS(UI)_手势1
2016-03-02 11:35
393 查看
手势_1
set集合中不能存放相同的对象。它是一组单值对象的集合,并且存入集合中的数据是无序的。手指触碰屏幕:
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { NSLog(@"手指触碰屏幕"); //获取对象 UITouch *touch = [touches anyObject]; //对象个数 NSLog(@"touch.tapCount = %lu",touch.tapCount); //显示触摸开始和最后改变的时间 NSLog(@"timestamp =%f",touch.timestamp); NSLog(@"%lu根手指",event.allTouches.count); // CGPoint point = [touch locationInView:self.view]; // NSLog(@"point = %@",[NSValue valueWithCGPoint:point]); /* 返回所有触摸对象 */ NSSet *set = event.allTouches; for (UITouch *t in set) { //找到手指在屏幕的位置 CGPoint point = [t locationInView:self.view]; NSLog(@"point = %@",[NSValue valueWithCGPoint:point]); } }
手指在屏幕上移动:
-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { NSLog(@"手指在屏幕上移动"); NSSet *set = event.allTouches; for (UITouch *t in set) { CGPoint point = [t locationInView:self.view]; NSLog(@"point = %@",[NSValue valueWithCGPoint:point]); } }
手指离开屏幕:
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { NSLog(@"手指离开屏幕"); }
无法识别的手势:
-(void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { NSLog(@"无法识别的手势"); }
相关文章推荐
- leetcode--Implement Stack using Queues
- Java中的Collection和Map(五)--PriorityQueue
- Error using subsindex Function 'subsindex' is not defined for values of class 'struct'.
- QtGui继承关系树
- EasyUI基础知识
- UITableView四周有多余的空白区域
- 一个奇怪的子线程更新UI问题
- require.js 模态框上利用defind加载js
- ueditor上传图片是提示找不到临时文件,怎么解?
- 系统简单的UIImagePickerController
- Android Gradle Build Error:Some file crunching failed, see logs for details解决办法
- Building QT projects from the command line
- SVN:Errors running builder 'DeploymentBuilder' on project---谷营中西软件科技园
- iOS UIButton 设置图片文字垂直排列
- 67.Which two statements are true regarding the ORDER BY clause? (Choose two.)
- iOS开发UItextfile弹出日期选择控制器输入日期
- Phoenix中Sequence的用法
- 【转载】C# Winform 跨线程更新UI控件常用方法总结
- UITableView学习笔记
- 【leetcode】【63】Unique Paths II