Table of Contents

intValue

 
- (int)intValue;
 

Returns the receiver’s value.

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

ObjC Sourcecode Example

    //** Sample Datatype **
    int myInt = 30;
 
    //** Initializing NSNumber Object **
    NSNumber *myIntNumber = [[NSNumber alloc]initWithInt:myInt];
 
    //**  To access your value use intValue **
    if ([myIntNumber intValue] == 30) {
 
        NSLog(@"myIntNumber: %@", myIntNumber);
        NSLog(@"myInt: %i", [myIntNumber intValue]);
 
    }

Output for this example code

2012-07-01 15:06:42.650 NSNumberSample[281:f803] myIntNumber: 30
2012-07-01 15:06:42.652 NSNumberSample[281:f803] myInt: 30