• 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
NSNumber numberWithBool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSNumber numberWithBool


  • Subject: NSNumber numberWithBool
  • From: mark hill <email@hidden>
  • Date: Mon, 29 Jan 2007 06:19:17 -0800 (PST)

I have declared a NSMutableDictionary thus:

  NSArray * keys      = [NSArray arrayWithObjects:
@"name", @"hidden", nil];
        NSArray * values    = [NSArray
arrayWithObjects: @"Object Name", [NSNumber
numberWithBool:false], nil];
        properties = [[NSMutableDictionary alloc]
initWithObjects: values forKeys: keys];

But cannot access the "hidden" BOOL value, it refers
to IB checkbox binding.

NSLog(@"%@", [properties valueForKeyPath: @"hidden"]);

returns 0 or 1 as expected, but I can't seem to
implement a conditional based on this!

The following does not work:

NSNumber *flag = [NSNumber numberWithBool: [properties
valueForKeyPath: @"hidden"]];


		if (CFBooleanGetValue(flag)) {
			// true

		}
		else {
			// false
		}

and neither does as simple:

if([flag boolValue]) {
}

Thanks for any help, and apologies if this is very obvious



____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSNumber numberWithBool
      • From: "Clark Cox" <email@hidden>
  • Prev by Date: NSTableView with bindings as a drag destination.
  • Next by Date: Re: KVO, design and documentaion
  • Previous by thread: Re: NSTableView with bindings as a drag destination.
  • Next by thread: Re: NSNumber numberWithBool
  • Index(es):
    • Date
    • Thread