Here is the problem, on the UI of my iPhone app, I have a button and another imageView that accepts Touch gesture recognizer, both have target actions. If I touch the button and the view one at a time, everything is fine. But if I touch these 2 simultaneously, or in rapid succession, things get messed up. The button and gesture handler manipulate the same state variables, so if they run side by side, the result is non-deterministic.
I tried to fix this problem by disabling the button the instant I get into gesture recognizer handler, and enabling it right before exiting the handler. But this doesn't solve my problem!!!
So the only possibility (my guess) is that the gesture recognizer gets triggered when the button handler is running. But this could only happen if they resides in separate threads. So does anyone know if the gesture recognizer handler is running in a different thread? Or, more specific to my problem, what should I do in my situation? Use guard variables to prevent conflict?
Comments
Post a Comment