In iOS is there anyway to prevent a UIView containing multiple buttons (siblings) from being simultaneously from being touched? For instance, two non-overlapping buttons that are side by side can be tapped at the same time with two touches.
+1
A:
on view and all subViews
[view setMultipleTouchEnabled:NO];
EDIT: add code so other buttons ignore touch events
One way to do this is to send resignFirstResponder
to other views in buttonPressed:
- (void)buttonPressed:(id)sender
{
// Assumes that the view only contains a bunch of buttons that you want to disable
// while you handle the first touch
[[self view] subviews] makeObjectsPerformSelector:@selector(resignFirstRespoder)];
// Do some stuff
....
....
// Re-enable all the buttons
[[self view] subviews] makeObjectsPerformSelector:@selector(becomeFirstRespoder)];
}
falconcreek
2010-08-13 16:41:33
Nope, that was the first thing I tried, setting all views to single-touch only. The problem is that the view are siblings so they get their own touch events. I want to prevent single multiple touches on multiple views.
pryomoax
2010-08-13 17:27:54