iOS 长按手势处理 ZCSHoldProgress

MIT
Objective-C
iOS
2014-10-04
红薯

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
    }
}
加载中

评论(0)

暂无评论

暂无资讯

暂无问答

暂无博客

返回顶部
顶部