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 butto开发者_开发百科n 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...
Use button.exclusiveTouch = YES
; on each of your buttons. You will need to hook them up to UIButtons
and set the property in viewDidLoad
for example
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!
Try yourView.multipleTouchEnabled = NO;
"yourView" here is the view contents all of your buttons.
精彩评论