我想是因Tap手势本身就时间比较短,相当于桌面系统的一次click, 因此就没有不会进入UIGestureRecognizerStateBegan, 直接就进入UIGestureRecognizerStateEnded 了。
-(void)handleMicButtonPanelLongPress:(UILongPressGestureRecognizer*)longGesture{
if ([longGesture state] == UIGestureRecognizerStateBegan) {
NSLog(@"LongGesture Start");
}
else if ([longGesture state] == UIGestureRecognizerStateEnded)
{
NSLog(@"LongGesture End");
}
}
-(void)handleMicButtonButtonTapped:(UITapGestureRecognizer*)tapGesture{
if ([tapGesture state] == UIGestureRecognizerStateBegan) {
NSLog(@"TapGesture Start");
}
else if ([tapGesture state] == UIGestureRecognizerStateEnded)
{
NSLog(@"TapGesture End");
}
}
2013-10-17 09:24:33.784[1364:907] LongGesture Start
2013-10-17 09:24:33.808[1364:907] LongGesture End
2013-10-17 09:24:34.784[1364:907] TapGesture End
2013-10-17 09:24:35.776[1364:907] TapGesture End
2013-10-17 09:24:37.087[1364:907] TapGesture End
2013-10-17 09:24:44.240[1364:907] LongGesture Start
2013-10-17 09:24:48.601[1364:907] LongGesture End
本文探讨了iOS中手势识别的状态转换机制,特别是针对长按(Long Press)与轻触(Tap)手势。通过实例展示了不同手势状态(如开始与结束)的触发条件,并解释了为何某些手势直接跳过开始状态。

891

被折叠的 条评论
为什么被折叠?



