NSNumber(只能包装数字类型)
代码语言:javascript
复制 NSNumber *num1 = [NSNumber numberWithInt:10];
NSNumber *num2 = [NSNumber numberWithFloat:10.1];
NSNumber *num3 = [NSNumber numberWithBool:YES];
NSNumber *num4 = @10;
NSValue(可以包装结构体)
代码语言:javascript
复制 (NSValue *)valueWithCGPoint:(CGPoint)point;
(NSValue *)valueWithCGVector:(CGVector)vector;
(NSValue *)valueWithCGSize:(CGSize)size;
(NSValue *)valueWithCGRect:(CGRect)rect;
代码语言:javascript
复制 CGPoint point = CGPointMake(10,20);
NSValue *value = [NSValue valueWithCGPoint:point];
NSLog(@"%@",value);//NSPoint: {10, 20}