I want to save the swtich state and load it when the program restarted.
[[NSUserDefaults standardUserDefaults] setBool:switchControl.on forKey:@"switch"];
[[NSUserDefaults standardUserDefaults] synchronize];
This is the saving part
BOOL test= [[NSUserDefaults standardUserDefaults] boolForKey:@"switch"];
NSLog(@"%@",test?@"YES":@"NO");
if(test == YES)
[switchControl setOn:YES animated:YES];
else
[switchControl setOn:NO animated:YES];
This is the part that is need to be set the switch to its value.I did this in viewdidload method because when i close the application and restarted it i want the state of the switch set the saved part .
But it is still showing the default part can u help me to set it?