I want to set a switch to off when the app enters into background. I am trying to do it using the following code. It isn’t working 🙁 When I resume app the switch is still “on” on animation on the screen. How can I fix this?
- (void)applicationWillResignActive:(UIApplication *)application {
[registrationSwitch setOn:NO animated:YES];
}
You need to set the value in userDefaults. Add a boolean check like:
put that in your
viewDidLoad