I have 1 method for two buttons in my UI, for touch up inside.
-(void)buttonPressed:(UIButton *)button{
[yButton setEnabled:NO];
[iButton setEnabled:NO];
pismeno = (button.tag == BUTTON_TAG_Y) ? PismenoYpsilon : PismenoJota;
[self setNewValues];
}
Everything works unless I press BOTH buttons at the EXACT same time. I try to disable them both after touch up inside here:
[yButton setEnabled:NO];
[iButton setEnabled:NO];
enabling them in the end of my setNewValues method. Like said, everything works, unless BOTH buttons are presses at the same time, then it crashes.
How can I eliminate this?
Thanks a lot 🙂
Martin, you can set the exclusiveTouch property on the UIButton to YES. Then only one button press will be registered.
Look at the exclusive touch property of the UIView class here: http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/uiview/uiview.html
Does that help?