Skip navigation.
 
mlBOOL value in Dictionary
FROM : Richard S. French
DATE : Fri Nov 21 14:48:05 2008

How does one get a boolean value from a dictionary object?
My XML dictionary contains the value </true> under the given key.
Should this be retrieved as NSNumber or some other object?

I am trying to set the state of a checkbox button based on the value as
below:

            // return syntax coloring switch
            BOOL *colorSwitch = NO;
            colorSwitch = [NSNumber numberWithBOOL:[temp
objectForKey:@"BBLMColorsSyntax"]];
            NSLog(@"Color: %@", colorSwitch);
            if ( colorSwitch == YES) {
                [colorBox setState:NSOnState];
            }
            else {
                [colorBox setState:NSOffState];
            }

Related mailsAuthorDate
mlBOOL value in Dictionary Richard S. French Nov 21, 14:48
mlRe: BOOL value in Dictionary Ken Thomases Nov 21, 15:13
mlRe: BOOL value in Dictionary Graham Cox Nov 21, 15:15
mlRe: BOOL value in Dictionary Heinrich Giesen Nov 21, 16:42
mlRe: BOOL value in Dictionary Michael Ash Nov 21, 16:51
mlRe: BOOL value in Dictionary David Blanton Nov 21, 16:54
mlRe: BOOL value in Dictionary Nick Zitzmann Nov 21, 17:19
mlRe: BOOL value in Dictionary Ed Wynne Nov 21, 17:20
mlRe: BOOL value in Dictionary Ken Thomases Nov 21, 17:25
mlRe: BOOL value in Dictionary Gary L. Wade Nov 21, 17:29
mlRe: BOOL value in Dictionary Clark Cox Nov 21, 20:01
mlRe: BOOL value in Dictionary Karl Goiser Nov 24, 06:20