Quy
Quy

Reputation: 43

iPhone: Reload view after switch back from foreground/background?

This is for iOS4 with multitask issue. How do I reload view after my app is re-appear from background running app?

Upvotes: 2

Views: 1060

Answers (1)

Shaggy Frog
Shaggy Frog

Reputation: 27601

You want your view controller to listen for UIApplicationWillEnterForegroundNotification:

Posted shortly before an application leaves the background state on its way to becoming the active application.

Also mentioned in the iOS Application Programming Guide:

The UIApplicationWillEnterForegroundNotification notification is also available for tracking when your application reenters the foreground. Objects in your application can use the default notification center to register for this notification.

In your handler for this notification, you can trigger whatever refreshing/redrawing you need.

You can read more about Notifications in the Cocoa Core Competencies document.

Upvotes: 2

Related Questions