iOS手势集合

长按手势

UILongPressGestureRecognizer *longGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressBtn:)];

    [longGesture setDelegate:self];

    longGesture.minimumPressDuration = 0.5;//默认0.5

    [self.detailView addGestureRecognizer:longGesture];

/**

*  长按触发方法

*

*  @param gestureRecognizer 长按手势

*/

– (void)longPressBtn:(UILongPressGestureRecognizer *)gestureRecognizer {

    if ([gestureRecognizer state] == UIGestureRecognizerStateBegan) {

         if (self.showBuildViewBlock) {

                   self.showBuildViewBlock();

         }

   } else if ([gestureRecognizer state] == UIGestureRecognizerStateEnded) {

    }

}

分享到: 更多
Separator image Posted in IOS.