0

I have an animation that runs for several seconds in response to a tap gesture. While the animation is running, the UITapGestureRecognizer won't respond to additional taps. Once the animation completes, the recognizer works again.

I've tried running the animation inside

dispatch_async(dispatch_get_main_queue(), etc.

but additional taps are still blocked. If I try running the animation inside

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), etc.

then the animation doesn't show at all. I vaguely remember reading somewhere that animations have to be run on the main thread.

Any suggestions for running an animation that doesn't block subsequent gestures? Thanks.

mjtitus
  • 165
  • 6

1 Answers1

0

If you're using UIView animation blocks, you can use +animateWithDuration:delay:options:animations:completion: with the UIViewAnimationOptionAllowUserInteraction option.

Also, you're correct that animations must be performed on the main thread.

thelaws
  • 7,991
  • 6
  • 35
  • 54
  • Thanks, that was exactly what I needed. I was using the more basic animateWithDuration: method. – mjtitus Dec 04 '12 at 03:17