//主要作用:
//由于OC中NSArray\NSDictionary中只能存储对象
//那么NSNumber就是用来把int\float\double等转换成对象
NSNumber * nb=[NSNumber numberWithInt:5];
NSArray * [email protected][nb];
NSNumber * nb2=arr.firstObject;
int a=nb2.intValue;
NSNumber * [email protected];
NSArray *[email protected][n];
NSNumber *n2=array.lastObject;
NSLog(@"%f",n2.floatValue);
//NSNumber继承NSValue
//NSValue是把结构体转换成对象
CGPoint cg=NSMakePoint(4, 5);
NSValue *value=[NSValue valueWithPoint:cg];
NSArray * [email protected][value];
NSValue * rel=arr2.firstObject;
CGPoint c=rel.pointValue;
时间: 2024-10-26 06:21:40