IBAction fires twice when quickly pressed

I have a weird problem. I have a view that is used to set custom preferences. I have this in my normal share menu, and when I click on the UIButtons inside this scene, they only execute the IBAction callback once. Even when you spam the button. It's good.

Now, in order to make things faster for the user, I am also allowing access to this same ViewController elsewhere. This time, instead of using push animation, I create a ViewController instance myself and show it on top of everything else. For some reason in this context, if I click buttons quickly, IBAction is called multiple times.

This is a problem for me because I have an execute function inside IBAction and it renders the following view twice. So when the user returns it, it goes back to the same view, and if you return it one more time it will crash the application.

I don't know how to solve this problem because the same UIViewController behaves differently in two different contexts ...

I am using xcode 4.5

+3


source to share





All Articles