我做了一个像这样的NSMutableArray,存储了一堆CGPoint
safeZonePoints = [NSMutableArray array];
[safeZonePoints addObject:[NSValue valueWithCGPoint:CGPointMake(234, 160)]];
[safeZonePoints addObject:[NSValue valueWithCGPoint:CGPointMake(284, 210)]];
[safeZonePoints addObject:[NSValue valueWithCGPoint:CGPointMake(334, 160)]];
[safeZonePoints addObject:[NSValue valueWithCGPoint:CGPointMake(284, 10)]];
[safeZonePoints addObject:[NSValue valueWithCGPoint:CGPointMake(234, 160)]];现在我可以从数组中获取NSValue,但是如何将NSValue转换回CGPoint
发布于 2014-07-30 21:32:51
做这样的事:
NSValue *cgpointObj = [NSValue valueWithCGPoint:CGPointMake(234, 160)];
CGPoint loc = cgpointObj.pointValue;请查看以下链接:CGPoint to NSValue and reverse
回答你的问题就足够了。
https://stackoverflow.com/questions/25047297
复制相似问题