I know that when iphone application goes to background, these methods are called:
- (void)applicationDidEnterBackground:(UIApplication *)application
- (void)applicationWillResignAct开发者_JAVA百科ive:(UIApplication *)application
what method(s) are called when application appears from background?
are there any methods in ViewController which are called?
thanks
Along with the applicationDidBecomeActive:
and applicationWillEnterForeground:
messages sent to the application delegate, the OS will also send corresponding UIApplicationDidBecomeActiveNotification
and UIApplicationWillEnterForegroundNotification
notifications.
You can have your view controller listen to these notifications:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(appWillEnterForegroundNotification:)
name:UIApplicationWillEnterForegroundNotification
object:nil];
Don't forget to remove yourself as an observer before your view controller gets destroyed.
– applicationDidBecomeActive:
– applicationWillEnterForeground:
Oops didnt read your question properly. These two methods are in the UIApplicationDelegate
– viewWillAppear:
– viewDidAppear:
And those are in UIViewController
精彩评论