标签:
//通过数字类型创建数字对象(装箱)
NSNumber *num1 = [[NSNumber alloc] initWithInteger:123];
NSLog(@"%@", num1);
NSNumber *num2 = [[NSNumber alloc] initWithDouble:12.3];
NSLog(@"%@", num2);
NSNumber *num3 = [NSNumber numberWithInt:34];
NSLog(@"%@", num3);
NSArray *arr1 = [NSArray arrayWithObjects:@"one", num1, nil];
NSLog(@"%@", arr1);
//数字对象转换为基本数字类型(拆箱)
NSInteger value1 = [num1 integerValue];
NSLog(@"value = %ld", value1);
标签:
原文地址:http://my.oschina.net/u/2448151/blog/501879