• 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
if ([[NSUserDefaults preferences] check box]==true) ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


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

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.

  • Follow-Ups:
    • Re: if ([[NSUserDefaults preferences] check box]==true) ?
      • From: Wade Tregaskis <email@hidden>
    • Re: if ([[NSUserDefaults preferences] check box]==true) ?
      • From: mmalcolm crawford <email@hidden>
    • Re: if ([[NSUserDefaults preferences] check box]==true) ?
      • From: Kevin Wojniak <email@hidden>
  • Prev by Date: needsToDrawRect broken?
  • Next by Date: Re: if ([[NSUserDefaults preferences] check box]==true) ?
  • Previous by thread: needsToDrawRect broken?
  • Next by thread: Re: if ([[NSUserDefaults preferences] check box]==true) ?
  • Index(es):
    • Date
    • Thread