write a global IBOutlet(in .h interface file) for your button and enable or disable where ever required.
ios - enable button programmatically from another function
-
15-06-2023 - |
Domanda
I have a button, proceedBtn. I set it in the interface builder to disable. I have radio buttons that I want to be selected before proceedBtn to be enabled. How to I set proceedBtn to enabled in the onRadioBtn function.
-(IBAction)onRadioBtn:(RadioButton*)sender
{
Singleton *single = [Singleton sharedInstance];
_statusLabel.text = [NSString stringWithFormat:@"Selected: %@", sender.titleLabel.text];
single.rb = sender.titleLabel.text;
NSLog(@"%@", sender.titleLabel.text);
}
- (IBAction)proceedBtn:(UIButton *)sender
{
Singleton *single = [Singleton sharedInstance];
NSLog(@"%@", single.rb);
if([single.rb isEqualToString: @"Choose Friend(s)"])
[self nameWallToFriends];
else
[self nameWallToChooseHome];
}
Soluzione
Altri suggerimenti
Enable it programmatically by any of your desired method from the same class :
[proceedBtnOutlet setEnabled:YES];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow