Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 884
A for Alpha Avatar asked Sep 05 '11 06:09

A for Alpha


People also ask

How do I turn off multi-touch on iPhone?

To turn off the multifinger swipe gesture, go to Settings > Home Screen & Dock > Multitasking.

How many touches can iPad detect?

Current iPad models (through Air 2) support 11 simultaneous touches, and do nothing on a 12th touch. What will the iPad Pro support?

What is dwell control on iPhone?

The Dwell options allow you to perform actions with the pointer without physically pressing buttons. Dwell has settings for Movement Tolerance and the amount of time before a selection action is carried out. When Dwell is enabled, the onscreen keyboard will always appear.


2 Answers

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

like image 184
medopal Avatar answered Nov 14 '22 23:11

medopal


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!

like image 40
msgambel Avatar answered Nov 14 '22 23:11

msgambel