On Sat, Aug 30, 2008 at 4:35 PM, Brad Gibbs <[EMAIL PROTECTED]> wrote: > While I did learn some things from this, I'm confused about NSUserDefaults > and the values it can store. I created an NSMutableDictionary to register > the defaults, which is, I believe archived as a property list. Floats can > be associated with NSString keys and stored in dictionaries, and there are > methods for floatForKey: and setFloat: forKey: so, storing floats in a > dictionary is supported, but, according to my understanding of Apple's > documentation, I can't archive floats in a property list. I thought that I > needed to transform the float into an NSNumber before saving to > NSUserDefaults, and then transform the NSNumber to a float before I could > use it to set the gradient angle.
Those two methods are simple conveniences for you. In reality they just convert to and from NSNumber without forcing you to do it: - (float)floatForKey:(NSString *)k { return [[self objectForKey:k] floatValue]; } - (void)setFloat:(float)f forKey:(NSString *)k { [self setObject:[NSNumber numberWithFloat:f] forKey:k]; } That's all, nothing weird or contradictory, just a little bit of a shortcut provided for you. Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]