I made an NSMutableArray
like this storing a bunch of CGPoint
s
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)]];
Now I can get the NSValue
s from the array, but how do I convert an NSValue
back to CGPoint
?
Do something like this:
NSValue *cgpointObj = [NSValue valueWithCGPoint:CGPointMake(234, 160)];
CGPoint loc = cgpointObj.pointValue;
Check out the following link: CGPoint to NSValue and reverse
It should be enough to answer your question.