Bored915 Bored915 - 1 year ago 144
Objective-C Question

Objective C touch event locking

Currently I'm running into an issue where there are table cells that allow for touch events to get there details. However, if the user presses the cell 2-4 times within 1 second it causes multiple view pushes onto the navigation view controller. This causes obvious errors when the views are popped off and the navigation controller has trouble going to a sub view and coming back. Leading to multiple traps, most unfortunately don't come with a error log. However, since this behavior shouldn't be supported in the first place. The question is besides thread locking is there other ways to prevent multiple touch events on either UiButtons or on table cells?

--Side Info--
Side information you may want, I am working with Xcode Version 6.4 due to the https vs http security settings added in Xcode 7. If later versions of Xcode automatically implement solutions to this then that would be good to know as well. Thank you for you help.

Answer Source

You can lock a button (or cell) after it tapped:

button.userInteractionEnabled = NO; 

or whole interface:

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];

and unlock when transition/loading is done.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download