我的代码:
[self.scrollView.panGestureRecognizer addTarget:self action:@selector(handlePanForScrollView:)];
- (void)handlePanForScrollView:(UIPanGestureRecognizer *)gesture {
switch (gesture.state) {
case UIGestureRecognizerStateBegan:
startScrollPoint = [gesture locationInView:self.scrollView];
break;
case UIGestureRecognizerStateEnded: {
NSLog(@"end");
}
default:
;
break;
}
}
开始状态工作正常。但是我在滚动时NSLog
显示了我的end
所有时间(因为它应该改变状态)。检测手势识别器结束状态的正确方法是什么?