在
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
方法我正在做一些动作并且在
中- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
方法我正在做其他一些行动。
如果我点击3次触摸,则会打3次。我想要的是如果用户连续点击只应执行的最后一次触摸操作。有可能吗?
答案 0 :(得分:1)
您可以尝试使用UITapGestureRecognizer
,然后在第一次点击后将其停用。
否则,您可以performSelector:withObject:afterDelay:
中的touchesEnded:withEvent:
使用cancelPreviousPerformRequestsWithTarget:selector:object:
和touchesBegan:withEvent:
中的{{1}}短暂延迟。
这有意义吗?