Table of Contents

boolValue

 
- (BOOL)boolValue;
 

Returns the receiver’s value.

Return Value - The receiver’s value as datatyp, converting it as necessary.

ObjC Sourcecode Example

    //** Sample Datatype **
    BOOL myBool = NO;
 
    //** Initializing NSNumber Object **
    NSNumber *myBoolNumber = [[NSNumber alloc]initWithBool:myBool];
 
    //**  To access your value use boolValue **
    if ([myBoolNumber boolValue] == NO) {
 
        NSLog(@"myBoolNumber: %@", myBoolNumber);
        NSLog(@"myBool: %i", [myBoolNumber boolValue]);
 
    }

Output for this example code

2012-06-03 18:40:00.105 NSNumberSample[500:f803] myBoolNumber: 0
2012-06-03 18:40:00.107 NSNumberSample[500:f803] myBool: 0