Burjua
Burjua

Reputation: 12706

What method is called when application appears from background on 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?

are there any methods in ViewController which are called?

thanks

Upvotes: 3

Views: 4215

Answers (2)

Ole Begemann
Ole Begemann

Reputation: 135550

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.

Upvotes: 9

willcodejavaforfood
willcodejavaforfood

Reputation: 44063

– applicationDidBecomeActive:
– applicationWillEnterForeground:

Oops didnt read your question properly. These two methods are in the UIApplicationDelegate

– viewWillAppear:
– viewDidAppear:

And those are in UIViewController

Upvotes: 1

Related Questions