I am trying to design a interface of an app, and i would only like to allow the user to press a UIButton once to get the result. Is there any way i can lock the button after the button is pressed? And release the lock only when another button is pressed?
Thanks
You can set the button to be disabled once it is clicked:
- (IBAction)clicked:(id)sender {
//See all buttons enabled
//Try a loop or manually
((UIButton *)sender).enabled = NO;
}
Of course you can. Just use the property enabled
of the UIButton. When the user presses it, set enabled to NO: [myButton setEnabled:NO];
, and set YES
when you need enable it again later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With