Search code examples
ios5uiapplicationdelegate

When to refresh a view when iOS app is being recalled from inactive/suspended


My app has time-sensitive information in a view that will need to be updated, when the app is recalled by the user, from an inactive/suspended state. Which of the two app delegate methods below should handle this?

Here:

- (void)applicationDidBecomeActive:(UIApplication *)application{

 //Check to see if we need to refresh a view
 if([self needToRefreshView])
   [viewcontroller1 refreshView];

}

or

Here:

- (void)applicationWillEnterForeground:(UIApplication *)application{


   //Check to see if we need to refresh a view
   if([self needToRefreshView])
   [viewcontroller1 refreshView];


 }

Is one method better suited for this than the other? If so, Why?

Thanks


Solution

  • Those should both work fine, the only other that I would consider implementing your code in is viewWillAppear.