Sunday, September 29, 2013

home button to exit the application, and then click Apply to which system will call the method?

I give my app set up Set bundle, home key to exit, and then to set up inside the app to change some of my preferences, and then click to enter the results when the app did not change the value. app in the existing methods are not called.
Great God seeking advice, in this case, which will be called systems approach ah?
Reply:
UiApplacationDelegate in applicationDidBecomeActive read your new configuration
Reply:
I also found a way:
Add the following code in viewDidLoad:
UIApplication * app = [UIApplication sharedApplication];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @ selector (applicationWillEnterForeground :) name: UIApplicationWillEnterForegroundNotification object: app];
Then implement applicationWillEnterForeground: Method
- (Void) applicationWillEnterForeground: (NSNotification *) notification {
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
[Defaults synchronize];
/ / RefreshInfo way is to write your own, used to retrieve the user's settings
[Self refreshInfo];
}

No comments:

Post a Comment