S.N. 方法和说明
1 + (NSNumber *)numberWithBool:(BOOL)value
Creates and returns an NSNumber object containing a given value, treating it as a BOOL.
2 + (NSNumber *)numberWithChar:(char)value
Creates and returns an NSNumber object containing a given value, treating it as a signed char.
3 + (NSNumber *)numberWithDouble:(double)value
Creates and returns an NSNumber object containing a given value, treating it as a double.
4 + (NSNumber *)numberWithFloat:(float)value
Creates and returns an NSNumber object containing a given value, treating it as a float.
5 + (NSNumber *)numberWithInt:(int)value
Creates and returns an NSNumber object containing a given value, treating it as a signed int.
6 + (NSNumber *)numberWithInteger:(NSInteger)value
Creates and returns an NSNumber object containing a given value, treating it as an NSInteger.
7 - (BOOL)boolValue
Returns the receiver's value as a BOOL.
8 - (char)charValue
Returns the receiver's value as a char.
9 - (double)doubleValue
Returns the receiver's value as a double.
10 - (float)floatValue
Returns the receiver's value as a float.
11 - (NSInteger)integerValue
Returns the receiver's value as an NSInteger.
12 - (int)intValue
Returns the receiver's value as an int.
13 - (NSString *)stringValue
Returns the receiver's value as a human-readable string.
下面是一个简单的例子,使用的NSNumber两个数字相乘,并返回该产品。