objective-ccocoa-touchuigesturerecognizeruipangesturerecognizeruilongpressgesturerecogni

Combining a UILongPressGestureRecognizer with a UIPanGestureRecognizer


I d'like to combine a UILongPressGestureRecognizer with a 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.


Solution

  • I found a solution: This UIGestureRecognizerDelegate method does exactly what I looked for:

    - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer 
    shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer