触摸(Touch)
来源:互联网 发布:大气监测实时数据 编辑:程序博客网 时间:2024/05/22 05:08
/**开始触摸时,记录点击的次数*//**开始触碰会调用*/- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ /**touches 是个集合 event是哪个类型的事件*/ /**随机取出一个对象*/ UITouch *touch = [touches anyObject]; /**触碰的次数*/ NSLog(@"%d",touch.tapCount);}
/**实现拖动*//**开始移动会调用*/- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ /**1.随机取出一个对象*/ UITouch *touch = [touches anyObject]; /**2.获取当前的位置*/ CGPoint current = [touch locationInView:self]; NSLog(@"%@",NSStringFromCGPoint(current)); /**3.获取上一外触碰点位置*/ CGPoint previous = [touch previousLocationInView:self]; /**4.修改当前view的位置(中点)*/ CGPoint center = self.center; center.x += current.x - previous.x; center.y += current.y - previous.y; self.center = center;}
0 0
- 触摸(Touch)
- 触摸touch
- touch手势与触摸
- 多点触摸multi-touch
- Android Touch 触摸事件
- UIScrollView touch 触摸事件
- touch触摸滑屏
- 触摸模式(Touch Mode)
- js 触摸事件 touch
- 【Touch】触摸事件onTouch
- touch触摸事件
- Android 多点触摸 multi-touch
- Windows Touch 触摸板编程
- Android 多点触摸 multi-touch
- quick-lua touch 触摸事件
- js多点触摸touch事件
- Android Touch 手势触摸原理
- 触摸事件 Touch MotionEvent ACTION
- 黑马程序员—反射篇
- Java I/O体系(二)
- poj 3683 2-sat
- 四、创建一个可复用的循环链表
- vi 常用命令行
- 触摸(Touch)
- xutils中dbutils的基础使用详解
- Matlab神经网络验证码识别
- servlet 异常
- web应用的过程中,http常见的错误代码
- windows如何在命令行下编译C/C++程序
- iOS 音乐类App必备功能:后台播放、锁屏封面、远程播放控制
- HDU 1236 排名 (排序+结构体)
- Cookie/Session机制详解