- (void) viewDidLoad {
[super viewDidLoad];
NSUserDefaults * defaults=[NSUserDefaults standardUserDefaults];
Self. RadioButton1. Selected=[defaults boolForKey: @ "radiobutton"].
Self. RadioButton2. Selected=[defaults boolForKey: @ "radiobutton"].
Self. RadioButton3. Selected=[defaults boolForKey: @ "radiobutton"].
[self. RadioButton1 addTarget: self action: @ the selector (RadioButton1) forControlEvents: (UIControlEventValueChanged)];
[the self view addSubview: self RadioButton1];
//Do any additional setup after loading the view.
}
- (IBAction) onRadioBtn: RadioButton *) sender {
_statusLabel. Text=[nsstrings stringWithFormat: @ "% @", sender. TitleLabel. Text];
NSUserDefaults * defaults=[NSUserDefaults standardUserDefaults];
BOOL an isSelected=[[NSUserDefaults standardUserDefaults] boolForKey: @ "radiobutton"].
An isSelected=! An isSelected;
[defaults setBool: sender. Selected forKey: @ "radiobutton"].
[defaults the synchronize];
}
@ end
CodePudding user response:
[radioButton setSelected: YES]
CodePudding user response:
See you write so no problemCodePudding user response: