Access preference value
I have been learning cocoa, reading alot and playing with code as I go. I have created a cocoa-project that kinda has a a sample of all the code I have read and tinkered with. In IB i have created a panel in my mainMenu nib that has a color well and an text size slider that are bound to the NSUserdefault system, which created an instance in the instances panel. The controls work and the values are retained in a pref file.
So back in Xcode, how do I retrieve the textSize value? I found some code:
NSUserDefaults *preferences = [[NSUserDefaults standardUserDefaults] retain];
// NSString *file = [[NSBundle mainBundle] pathForResource:@"Defaults" ofType:@"plist"];
// NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:file];
// [preferences registerDefaults:dict];
Isn't there already an instance created by the nib file or do I need to create a new instance to retrieve the value?
Thank you,
Todd
Oops that code sets default values from from a file. But I believe the first line is what is relevant. I commented out the irrelevant lines.
I plan on using the default pref file in ~/library/preferences/...