码迷,mamicode.com
首页 > 移动开发 > 详细

ios手势识别之长按

时间:2016-01-23 23:02:22      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:

 1     // 1.创建手势识别器
 2     UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] init];
 3     // 1.1设置长按手势识别器的属性
 4     //    longPress.minimumPressDuration = 5;
 5     
 6     // 手指按下后事件响应之前允许手指移动的偏移位
 7     longPress.allowableMovement = 50;
 8     
 9     
10     // 2.添加手势识别器到View
11     [self.customView addGestureRecognizer:longPress];
12     
13     // 3.监听手势识别器
14     [longPress addTarget:self action:@selector(longPressView)];
15 }
16 
17  -(void)longPressView
18 {
19     NSLog(@"长按事件");
20 }

 

ios手势识别之长按

标签:

原文地址:http://www.cnblogs.com/PJHome/p/5154172.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!