如何同时使用两个手势识别器
在我的视野中,我有几幅图像。所有这些图像都链接到 LongPressGestureRecognizer 和 PanGestureRecognizer。
当用户按住(LongPressGesture)时,图像会产生动画(摆动)。当用户拖动图像时,LongPressGesture 到位后,动画会暂停。当用户停止拖动时,动画将继续。
有没有办法同时使用两个手势识别器,以便当用户拖动图像时我的动画不会暂停?
非常感谢帮助!
Within my view I've got several images. All of those images are linked to a LongPressGestureRecognizer and a PanGestureRecognizer.
When a user Press and holds (LongPressGesture) the image animates (wiggles). When the users drags the image ,after the LongPressGesture takes in place, the animation pauzes. When the user stops dragging the animation continues.
Is there a way to use two gestureRecognizers simultaniously so that my animation doesn't pauzes when a user drags the image?
Help is greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用这个方法:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;
Use this methods :
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;