问题描述
我喜欢结合UILongPressGestureRecognizer和UIPanGestureRecognizer。
I d'like to combine a UILongPressGestureRecognizer with a UIPanGestureRecognizer.
UIPanGestureRecognizer应该从长按开始。有没有简单的方法来做到这一点?或者我真的要写自己的手势识别器吗?
The UIPanGestureRecognizer should start with a long press. Is there a simple way to do this? or do I really have to write my own gesture recognizer?
我不知道在主屏幕上的东西。你按一个图标,一段时间后,图标开始摆动。
I wan't something like on the home screen. You press on an icon and after some time the icons start wobbling. Afterwards without releasing my finger from the screen I can start dragging the icon under my finger around.
推荐答案
我发现了一个解决方案:
这个UIGestureRecognizerDelegate方法完全符合我的要求:
I found a solution: This UIGestureRecognizerDelegate method does exactly what I looked for:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
这篇关于将UILongPressGestureRecognizer与UIPanGestureRecognizer组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!