iOS 保存CGRect,CGPoint到NSArray'的方法
由于CGRect和CGPoint等对象是Struct,即结构体,不是继承于NSObject的,所以需要先用NSValue的方法,把他们转化成NSValue对象,之后就可以存入NSArray了!
@interface NSValue (NSValueUIGeometryExtensions) + (NSValue *)valueWithCGPoint:(CGPoint)point; + (NSValue *)valueWithCGSize:(CGSize)size; + (NSValue *)valueWithCGRect:(CGRect)rect; + (NSValue *)valueWithCGAffineTransform:(CGAffineTransform)transform; + (NSValue *)valueWithUIEdgeInsets:(UIEdgeInsets)insets; + (NSValue *)valueWithUIOffset:(UIOffset)insets NS_AVAILABLE_IOS(5_0); - (CGPoint)CGPointValue; - (CGSize)CGSizeValue; - (CGRect)CGRectValue; - (CGAffineTransform)CGAffineTransformValue; - (UIEdgeInsets)UIEdgeInsetsValue; - (UIOffset)UIOffsetValue NS_AVAILABLE_IOS(5_0); @end