CGRect rect = CGRectMake(160, 230, 200, 200);

CGPoint point = CGPointMake(20, 20);

CGSize size =  CGSizeMake(20, 20);

NSString *str = NSStringFromCGRect(rect);

NSString *str1 = NSStringFromCGSize(size);

NSString *str3 =  NSStringFromCGPoint(point);

NSMutableArray *array = [[NSMutableArrayalloc]initWithCapacity:0];

[array addObject:str];

[array addObject:str1];

[array addObject:str3];

CGRect rect1 = CGRectFromString(array[0]);

CGSize size1  = CGSizeFromString(array[1]);

CGPoint point1 = CGPointFromString(array[2]);

   需要往数组、字典中封装的时候、还可以转换成NSValue封装的。

05-27 23:36