Re: if ([[NSUserDefaults preferences] check box]==true) ?
Re: if ([[NSUserDefaults preferences] check box]==true) ?
- Subject: Re: if ([[NSUserDefaults preferences] check box]==true) ?
- From: Alastair Houghton <email@hidden>
- Date: Sun, 9 Nov 2003 10:54:40 +0000
Also, if you are testing against true, *don't* use == to do it. C and
most of the code written in it assumes that any non-zero value is true,
so you can trip yourself up and end-up in a situation where something
appears (to your code) to be neither true or false.
IMO it's also not a good idea to use == for comparison with false
either, mainly because that makes the test different to the one you use
for true... but that's a style issue and we shouldn't really be
discussing those because of the fire risk ;->
Kind regards,
Alastair.
On 9 Nov 2003, at 05:36, Kevin Wojniak wrote:
>
Try using...
>
>
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"checkBox"]
>
boolValue])
>
>
...Kevin
>
>
>
On Nov 8, 2003, at 6:27 PM, Kurt Marek wrote:
>
>
> 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")
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.