iphone development: disabling user interaction during the animation

death7eater picture death7eater · Sep 6, 2012 · Viewed 9.5k times · Source

in my app I have some animations. for example I have a button in my main menu and when you click it animation begins (like moving some place etc.) and at the end of the animation it is navigated to an another page. What I need is disabling the user interaction during the animation. because during the animation If I press the starting point of my button, the page which is supposed to be navigated is opened twice. To sum up, If I do not let any kind of user interaction during the animation, my problem will be solved. How can I do that?

Answer

swebal picture swebal · Sep 6, 2012

Before animation:

self.view.userInteractionEnabled = NO;

and in animation completion block:

self.view.userInteractionEnabled = YES;