如何同时使用两个gestureRecognizers

时间:2011-03-30 10:25:48

标签: iphone image animation drag uigesturerecognizer

在我看来,我有几张照片。所有这些图像都链接到LongPressGestureRecognizer和PanGestureRecognizer。

当用户按住(LongPressGesture)时,图像会动画(摆动)。当用户拖动图像时,在LongPressGesture到位后,动画会暂停。当用户停止拖动时,动画继续。

有没有办法同时使用两个gestureRecognizers,这样当用户拖动图像时我的动画不会暂停?

非常感谢帮助!

2 个答案:

答案 0 :(得分:1)

使用此方法: - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;

答案 1 :(得分:0)

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}