Search code examples
iphoneiosuiviewuitouch

How to control the number of simultaneous touches on a view in iOS


I have a UIView which contains almost 10 buttons which performs different actions. The user will be able to touch or tap on any button to perform a required action. But, i am getting a problem when the user presses multiple buttons at the same time. When two buttons are pressed at the same time(simultaneously) two actions are getting performed. Some times the app is getting crashed. So, i dont want the user to tap multiple buttons simultaneously. Is there any way in which i can ask a view to recognize only single touch instead of multiple touches or at least can i increase the time gap between multiple touch gestures...


Solution

  • This is a similar post, which has a nice solution. You essentially just hook up all the buttons to the same method, and have a switch statement. Hope that Helps!