Once I understood what was required, this was pretty easy to implement. To save you some trouble if you've found this thread while searching for help doing the same thing:
In my main controller, I added the following line to
awakeFromNib:
Code:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(preferencesChanged) name:@"PreferencesChanged" object:nil];
Since it will be looking for a method called "preferencesChanged", I also added this to the main controller:
Code:
- (void) preferencesChanged; {
/*
Code to deal with changed preferences goes here
*/
}
Finally, in my Preferences controller, I added this line to the code that applies changes after the user has made their choices:
Code:
[[NSNotificationCenter defaultCenter] postNotificationName:@"PreferencesChanged" object:nil];
So, when the code hits the "postNotificationName" line, it drops a message named "PreferencesChanged" into the Notification dispatch table. The observer (in the main controller) is primed to look for any notifications named "PreferencesChanged", and when one is found, it redirects processing to the
preferencesChanged method.
-- Mark