我试图在平移时不要让我的平移手势垃圾邮件功能,它只在平移完成时播放一次功能,我已经在线看了所有并且找不到这样做的方法。有人有任何解决方案吗?
以下当前代码:
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget: self action:@selector(didPan:)];
self.mapView.gestureRecognizers = @[panRecognizer];
- (void) didPan:(UIPanGestureRecognizer*) gestureRecognizer
{
NSLog(@"DID PAN");
}
答案 0 :(得分:5)
- (void)panGestureDetected:(UIPanGestureRecognizer*)panGesture {
if(panGesture.state == UIGestureRecognizerStateEnded){
//do whatever
}
}
答案 1 :(得分:0)
ViewController.h
@property(强,非原子)IBOutlet UIImageView * img;
ViewController.m
viewDidLoad
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panDetected:)];
[_img addGestureRecognizer:panRecognizer];