I have two view controller classes in my application delegate. I can change from one view controller to the next view controller by issuing the method -pushViewController:animated of the navigationController class and going back to the previous view controller by calling the method -popViewController:animated. Now my problem is I want to save some value to the preferences by using NSUserDefaults when I go back to the first view controller, and I don't know where should I put:
[[NSUserDefaults standardUserDefaults] setObject:@"value" forKey:@"key"];