views:

60

answers:

2

I created a Settings.bundle in my app where the user can change some properties like font size. It works.

But when I leave my App, and I change my setting, I don't know how I can get notified of the change. For the moment, I create a function call each time a view is loaded that check for app settings. But I wonder if there is an other and proper way to do this.

+2  A: 

You should use your app delegate's application:didFinishLaunchingWithOptions:, or an equivalent location, to check your NSUserDefaults values, or just read them in a UIViewController viewDidLoad method.

While there is no multi-tasking, this is more than adequate. On MacOS X Cocoa we use KVO and bindings to check for changes during the execution of an application; no doubt something similar will work for 4.0 if required.

Paul Lynch
I used to check setting values in the application:didFinishLaunching, but the problem is that when the user leave the app, change the value of font size (for exemple), and come back to my app, the application:didFinishLaunching function is not callback, so change isn't taked into account.
Raphael Pinto
It is always called on launch. You can't get from Settings to your app without launching it in 3.x.
Paul Lynch
A: 

I finally found the solution. Like you said Paul, for 4.0 sdk version, there is something similar and I found it in "UIApplicationDelegate protocol". Thank you for helping me. ;)

Raphael Pinto