我有一個長時間按下後翻轉的UIView。在模擬器中精美地工作,但在現實世界中,人的手指在按壓時有微小的移動。這些微小的動作重置手勢並立即觸發手勢結束狀態。iOS8 - 如何更改iOS中長按手勢的靈敏度8
- (void)viewDidLoad {
...
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(didLongPress:)];
longPress.minimumPressDuration = 0.7;
[self.view addGestureRecognizer:longPress];
}
- (void)didLongPress:(UILongPressGestureRecognizer *)gestureRecognizer {
if (gestureRecognizer.state == UIGestureRecognizerStateBegan)
{
[UIView transitionFromView:self.questionCardView toView:self.answerCardView
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromLeft
completion:nil];
}
else
{
[UIView transitionFromView:self.answerCardView toView:self.questionCardView
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromRight
completion:^(BOOL finished){
[self.view addSubview:self.questionCardView];
[self.view sendSubviewToBack:self.questionCardView];
}];
}
}