Re: if ([[NSUserDefaults preferences] check box]==true) ?
Re: if ([[NSUserDefaults preferences] check box]==true) ?
- Subject: Re: if ([[NSUserDefaults preferences] check box]==true) ?
- From: Wade Tregaskis <email@hidden>
- Date: Sun, 9 Nov 2003 13:45:46 +1100
I've tried all of the following and none of them seem to work:
if ([[NSUserDefaults standardUserDefaults]
objectForKey:@"checkBox"]==1)
if ([[NSUserDefaults standardUserDefaults]
objectForKey:@"checkBox"]==true)
if ([[NSUserDefaults standardUserDefaults]
objectForKey:@"checkBox"]==YES)
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"checkBox"]
isEqual:@"true")
Remember that dictionaries associated objects (keys) with objects
(values). 1, true and YES or not objects. You were closer with
@"true", since that is an object, but as has been pointed out the
standard mechanism for storing numbers (and thus booleans) is the
NSNumber class.
Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.