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...
Asked
Active
Viewed 3,563 times
3 Answers
6
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

mohdajami
- 9,604
- 3
- 32
- 53
5
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!
-
Exactly. If you wanted it to have a wait period, you need only have an `NSTimer` which is set for how long you wanted it to wait, which triggers a method that sets some global `BOOL` value to `YES`, and have the button method incorporate said `BOOL`. – msgambel Sep 05 '11 at 07:13
-
The link is pretty good.. +1 for that MS... i will try that and let you know the result in some time – A for Alpha Sep 05 '11 at 07:53
-
2This is seriously overdoing it. `button.exclusiveTouch = YES` is all you need. – BJ Homer May 22 '12 at 21:12
1
Try yourView.multipleTouchEnabled = NO;
"yourView" here is the view contents all of your buttons.

xuzhe
- 5,100
- 22
- 28