• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: if ([[NSUserDefaults preferences] check box]==true) ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: if ([[NSUserDefaults preferences] check box]==true) ?


  • Subject: Re: if ([[NSUserDefaults preferences] check box]==true) ?
  • From: Kurt Marek <email@hidden>
  • Date: Sat, 8 Nov 2003 19:33:39 -0800

Thanks. That works wonderfully. I knew it was something silly.

Kurt

On Nov 8, 2003, at 9:36 PM, Kevin Wojniak wrote:

Try using...

if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"checkBox"] boolValue])

...Kevin


On Nov 8, 2003, at 6:27 PM, Kurt Marek wrote:

I have set up a prefs pane using the new defaults controller. I'm
trying to figure out if a check box is true of false, but I can't
figure out how to test the condition. I've always set these up
programatically to switch a boolean, but I'm not really sure how the
defaults controller sets the value. If I send the value to NSLog it
comes back as true or false.

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")

Can someone help me out here?

Kurt
_______________________________________________
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.


_______________
www.kainjow.com
aim: kainjow1
_______________________________________________
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.
_______________________________________________
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.

References: 
 >if ([[NSUserDefaults preferences] check box]==true) ? (From: Kurt Marek <email@hidden>)
 >Re: if ([[NSUserDefaults preferences] check box]==true) ? (From: Kevin Wojniak <email@hidden>)

  • Prev by Date: can't rename file
  • Next by Date: Re: AltiVec programming? Mailing list?
  • Previous by thread: Re: if ([[NSUserDefaults preferences] check box]==true) ?
  • Next by thread: Re: if ([[NSUserDefaults preferences] check box]==true) ?
  • Index(es):
    • Date
    • Thread