长按手势-iOS

2017-01-06  本文已影响103人  HAKA
UILongPressGestureRecognizer* longPressGr =          [[UILongPressGestureRecognizeralloc]initWithTarget:selfaction:@selector(longPressToDo:)];

longPressGr.minimumPressDuration=3.0;

[iconImagViewaddGestureRecognizer:longPressGr];

#pragma mark长按手势
  -(void)longPressToDo:(UILongPressGestureRecognizer*)gesture
 {
//直接return掉,不在开始的状态里面添加任何操作,则长按手势就会被少调用一次了
    if(gesture.state!=UIGestureRecognizerStateBegan)
    {
      return;
    }
}
上一篇下一篇

猜你喜欢

热点阅读