What method is called when the application appears from the background on the iPhone?

I know that when the iphone application goes into the background, these methods are called:

- (void)applicationDidEnterBackground:(UIApplication *)application
- (void)applicationWillResignActive:(UIApplication *)application

which method is called when the application appears from the background?

Are there any methods in the ViewController that are called?

thank

+3
source share
2 answers

Along with messages applicationDidBecomeActive:and applicationWillEnterForeground:sent to the application delegate, the OS will also send corresponding notifications UIApplicationDidBecomeActiveNotificationand UIApplicationWillEnterForegroundNotification.

You may have your view controller to listen to these notifications:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(appWillEnterForegroundNotification:) 
                                             name:UIApplicationWillEnterForegroundNotification 
                                           object:nil];

Remember to shoot yourself as an observer before your controller is destroyed.

+9
source
– applicationDidBecomeActive:
– applicationWillEnterForeground:

. UIApplicationDelegate

– viewWillAppear:
– viewDidAppear:

UIViewController

+1

Source: https://habr.com/ru/post/1766029/


All Articles