views:

85

answers:

3

When the user changes NsuserDefaults in settings on the iPhone and activates my app after it being suspended, i want to reload the active view.

How can i do this?

A: 

- (void)applicationWillEnterForeground:(UIApplication*)application on the App Delegate is invoked when coming out of suspend.

Implement this method, in it check if the setting you are about has changed, find your topmost view controller and reload it's view then.

psychotik
ThanksI am updating the NSUserDefaults in - (void)applicationDidBecomeActive:(UIApplication *)application; is it better to do it in the method you listed?How do i find my topmost view?
Larsaronen
If you're using a UINavigationController you can find it by using [navController topViewController]
OlivaresF
Great! I'm using a tabbarcontroller, but i guess something like [[tabBarController.navigationController topViewController] setNeedsDisplay]; would work? Gonna have to try that later..
Larsaronen
A: 

You could implement the applicationDidBecomeActive: method in your application delegate, or register for the UIApplicationDidBecomeActiveNotification notification in any other object.

David Gelhar
Thaks I ended up registring for notification in each view.
Larsaronen
A: 

I tried pushing another view from my top view controller, after resuming from background. It did not happen. No errors shown.

Akash Thambiran