in order to save the basic data types like int, float, bool in object form Objective-C provides a range of methods to work with NSNumber
What is NSNumber
NSNumber is a subclass of NSValue that offers a value as any C scalar (numeric) type.
Methods to work with NSNumber
- Creates and returns
- Returns the receiver’s
Creates and returns
methods use to creates and returns an NSNumber object containing a given value, treating it to some data type .
- + (NSNumber *)numberWithBool:(BOOL)value
- + (NSNumber *)numberWithChar:(char)value
- + (NSNumber *)numberWithDouble:(double)value
- + (NSNumber *)numberWithFloat:(float)value
- + (NSNumber *)numberWithInt:(int)value
- + (NSNumber *)numberWithInteger:(NSInteger)value
Returns the receiver’s
Returns the receiver’s value data type.
- – (BOOL)boolValue
- – (char)charValue
- – (double)doubleValue
- – (float)floatValue
- – (NSInteger)integerValue
- – (int)intValue
- – (NSString *)stringValue