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 th开发者_如何学运维is.
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.
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. ;)
精彩评论