NSValue (将结构体包装成NSValue)
将结构体包装成 NSValue ,并取出结构体
1 NSRect rect = {0, 0, 200,200}; 2 NSValue *rectValue = [NSValue valueWithBytes:&rect objCType:@encode(NSRect)]; 3 NSRect newRect; 4 [rectValue getValue:&newRect]; 5 NSLog(@"%f,%f,%f,%f",newRect.origin.x,newRect.origin.y,newRect.size.width,newRect.size.height);