Skip to main content

In iOS, Is GestureRecogizer target action running in a separate thread?



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

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?