Raphael Pinto
Raphael Pinto

Reputation: 279

How to detect application préference changes

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.

Upvotes: 0

Views: 325

Answers (2)

Raphael Pinto
Raphael Pinto

Reputation: 279

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. ;)

Upvotes: 0

Paul Lynch
Paul Lynch

Reputation: 19789

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.

Upvotes: 2

Related Questions