ZCSHoldProgress - iOS 长按手势处理


MIT
iOS
Objective-C

软件简介

ZCSHoldProgress是UILongPressGestureRecognizer的子类扩展。用来处理长按手势事件。

示例代码:

#import "ZCSHoldProgress.h"

ZCSHoldProgress *holdProgress = [[ZCSHoldProgress alloc] initWithTarget:self action:@selector(gestureRecogizerTarget:)];
holdProgress.minimumPressDuration = 3.0;
[self.view addGestureRecognizer:holdProgress];

- (void)gestureRecogizerTarget:(UIGestureRecognizer *)gestureRecognizer {
    if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
        // TODO: do something interesting
    } else if (gestureRecognizer.state == UIGestureRecognizerStatePossible) {
        // TODO: knock it off with the interesting stuff
    }
}