当前位置: 代码迷 >> Iphone >> iphone开发中怎么判断长按事件
  详细解决方案

iphone开发中怎么判断长按事件

热度:32   发布时间:2016-04-25 06:36:07.0
iphone开发中如何判断长按事件

?

如题,在iphone开发中,如何判断长按事件呢?

?

1.?UILongPressGestureRecognizer

?

2.在touchBegan里面[self performSelector:@selector(longPressMethod:) withObject:nil afterDelay:longPressTime]
然后在 end 或cancel里做判断,如果时间不够长按的时间调用 [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(longPressMethod:) object:nil]取消began里的方法

  相关解决方案