问题描述
我知道,当iphone应用程序进入后台时,这些方法称为:
I know that when iphone application goes to background, these methods are called:
- (void)applicationDidEnterBackground:(UIApplication *)application
- (void)applicationWillResignActive:(UIApplication *)application
应用程序从后台出现时会调用什么方法?
what method(s) are called when application appears from background?
ViewController中有没有被调用的方法?
are there any methods in ViewController which are called?
谢谢
推荐答案
以及发送给应用程序委托的 applicationDidBecomeActive:
和 applicationWillEnterForeground:
消息,操作系统还将发送相应的 UIApplicationDidBecomeActiveNotification
和 UIApplicationWillEnterForegroundNotification
通知.
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.
这篇关于当应用程序从iPhone后台出现时,调用什么方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!