iOS 捕获长按事件,跟踪滑动轨迹
来源:互联网 发布:windows教育版 编辑:程序博客网 时间:2024/05/16 12:31
ViewController.m
代码:
#import "ViewController.h"@interface ViewController (){ UIView *touchView;}@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. touchView = [[UIView alloc] init]; touchView.backgroundColor = [UIColor brownColor]; touchView.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height / 2 - [UIScreen mainScreen].bounds.size.height / 4, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height / 2); [self.view addSubview:touchView]; UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressedOncell:)]; [touchView addGestureRecognizer:longPress]; longPress.allowableMovement = NO; longPress.minimumPressDuration = 0.5;}-(void)longPressedOncell:(id)sender{ CGPoint p = [(UILongPressGestureRecognizer *)sender locationInView:touchView]; NSLog(@"press at %f, %f", p.x, p.y);}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}@end
0 0
- iOS 捕获长按事件,跟踪滑动轨迹
- ios长按事件
- 移动端点击事件、滑动事件、长按事件封装
- iOS 长按事件 UILongPressGestureRecognizer
- ios button长按事件
- IOS 长按手势事件
- ios按钮长按事件
- UIView只收集move轨迹,不接收“单击”、“长按”事件
- listview获得每一项的点击,长按,滑动事件
- RecycleView的单击和长按,滑动事件
- ios-添加长按事件
- IOS长按事件的方法
- IOS UIbutton的长按事件实现
- IOS长按事件--UILongPressGestureRecognizer
- iOS 长按事件的解决方法
- ios 触发UIButton长按事件
- IOS长按事件的方法
- IOS Gesture手势(点击、捏合、滑动、长按、旋转、拖动)
- iOS笔记之_C语言流程控制
- Ubuntu安装appium过程整理
- iOS 常用四种数据存储方式
- F5刷新-引起表单重复提交解决-<s:token />
- 关于ES、PES、PS以及TS码流
- iOS 捕获长按事件,跟踪滑动轨迹
- Hibernate4是用二级缓存的步骤
- linux 服务器优化设置
- 指针数组和数组指针的区别
- 单向哈希函数 JAVA版本
- WebService端口号修改
- 通过SpringAOP+注解实现自动代理
- Android 传感器之《加速传感器》——摇一摇功能
- android通过camera和surfaceview选择摄像头并即时预览