0
votes

I have 4 subviews in a UIViewController page arranged as a grid. Sometimes, animations will be running on the subviews. I am trying to recognize taps on one of the subviews (using UITapGestureRecognizer).

Now, the when animation is not running, taps are recognized smoothly. But, when an animation is running, most of my taps are not recognized at all (even when animation is running on another subview).

Is there any way to increase priority of the Gesture recognizer than the animation ? Any suggestions are appreciated. Thanks

2

2 Answers

1
votes

The issue was due to setting animation options as 0. After adding UIViewAnimationOptionAllowUserInteraction as the animation option, it works nicely.

0
votes

This sounds like a classic case of the main thread being clogged up. Multithreading will solve your problem.

Do something like this:

-(void)performAnimations{
    //Do your animations in this method
}

Once you have your animations in a separate method, you're free to do this:

[self performSelectorInBackground:@selector(performAnimations)];

This will leave your main thread free to recognize the touch events :)