ZCSHoldProgress
以下是使用效果:
https://github.com/zshannon/ZCSHoldProgress
"Your users be pressin' long, but do they know how long they need to be pressin'?"
“你的用户正在长按屏幕,但是,他们怎么知道需要长按多长时间?”
ZCSHoldProgress is a UILongPressGestureRecognizer subclass with some nice (customizable) visual flair.
ZCSHoldProgress是继承于UILongPressGestureRecognizer,附带可视化效果(可以定制)。
Add to your Podfile - 用Podfile安装
pod 'ZCSHoldProgress', '~> 0.0.5'
Use in your project - 在你的项目中使用
Setup - 设置
#import "ZCSHoldProgress.h" ZCSHoldProgress *holdProgress = [[ZCSHoldProgress alloc] initWithTarget:self action:@selector(gestureRecogizerTarget:)]; holdProgress.minimumPressDuration = 3.0; [self.view addGestureRecognizer:holdProgress];
Target Action - 目标响应
- (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 } }
时间: 2024-10-02 10:17:48