I am doing and setting for my application. I am able to be notified that my setting defaults have been changed ( by changing them in the Setting application ). However, how can I let other classes knowing that the default settings has been changed
3 Answers
There are several ways you can achieve that:
First - have the other classes check the values every time when needed, by coding the Settings Container as an always available singleton pattern object.
Second - have all relevant classes be notified via NSNotification when required.
And probably many more...

- 11,900
- 5
- 36
- 33
-
1can you specify then. I just go over [link](http://developer.apple.com/library/ios/#samplecode/AppPrefs/Introduction/Intro.html) and know that they notified their other class (is TableViewController)by using [table reloadData].What if our other classes are not tableView.. – tonytran Jan 26 '12 at 04:13
if you have several class to notify then you can use NSNotificationCenter for notifying then. In this thread you can get an idea for using Notification center

- 1
- 1

- 7,042
- 7
- 35
- 48
The link that you provided shows everything you need to do.
This code:
[[NSNotificationCenter defaultCenter] addObserver:yourClassThatNeedsToBeNotified selector:@selector(selectorNameOfYourClass:)
name:UIApplicationDidFinishLaunchingNotification object:nil];
is dedicated to add notification about any change of NSUserDefaults.
So if you have several classes that have to get this notification just add this code to each class init method, and don't forget to remove this notification in dealloc.

- 171
- 1
- 8