手势 UILongPressGestureRecognizer 长按手势
2014-09-18 00:00
295 查看
UILongPressGestureRecognizer * longPressGesture = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(handleLongpressGesture:)];
设置长按手势触发的时间
longPressGesture.minimumPressDuration = 1;
[redView addGestureRecognizer:longPressGesture];
[longPressGesture release];
长按手势 可能会触发两次 (开始接触 和 结束接触 ) 所以 长按手势要判断状态
- (void)handleLongpressGesture :(UILongPressGestureRecognizer *)longPressGesture
{
当识别到长按手势时触发(长按时间到达之后触发)
if (UIGestureRecognizerStateBegan ==longPressGesture.state) {
longPressGesture.view.backgroundColor = [UIColor random];
}
}
设置长按手势触发的时间
longPressGesture.minimumPressDuration = 1;
[redView addGestureRecognizer:longPressGesture];
[longPressGesture release];
长按手势 可能会触发两次 (开始接触 和 结束接触 ) 所以 长按手势要判断状态
- (void)handleLongpressGesture :(UILongPressGestureRecognizer *)longPressGesture
{
当识别到长按手势时触发(长按时间到达之后触发)
if (UIGestureRecognizerStateBegan ==longPressGesture.state) {
longPressGesture.view.backgroundColor = [UIColor random];
}
}
相关文章推荐
- UITableView 添加长按手势UILongPressGestureRecognizer
- UITableView 添加长按手势UILongPressGestureRecognizer
- 手势 UILongPressGestureRecognizer 长按手势
- 26.手势识别之UILongPressGestureRecognizer
- UITableView长按手势UILongPressGestureRecognizer
- IOS给tableview的cell添加长按手势执行两次(UILongPressGestureRecognizer)
- UITableView长按手势UILongPressGestureRecognizer
- UILongPressGestureRecognizer长按手势
- ios手势之UILongPressGestureRecognizer
- ios 长按手势UILongPressGestureRecognizer 开始/结束(按下/抬起)
- iOS长按手势UILongPressGestureRecognizer
- 将UILongPressGestureRecognizer写成Block
- 关于UILongPressGestureRecognizer和UIPanGestureRecognizer同时使用
- UILongPressGestureRecognizer代码摘抄
- UILongPressGestureRecognizer的selector多次调用解决方法
- UILongPressGestureRecognizer
- 关于UILongPressGestureRecognizer调用多次的问题
- 启用长按事件 UILongPressGestureRecognizer
- UILongPressGestureRecognizer 触发两次解决
- iPhone开发之手势的预习—— UITapGestureRecognizer pinch捏合 longPress长按 rotation旋转