How to add CGPoint to NSMutableArray

CGPoint is a C structure not an object. So you can’t add CGPoint to NSMutableArry directly.
But you can use NSValue to convert it to object. like this:

1
2
3
CGPoint point = CGPointMake(0.0,0.0);
NSValue *pointValue = [NSValue valueWithCGPoint:point];
[nsarray addObject:pointValue];

It is very simple to get this value .

1
CGPoint point = [[nsarray objectAtIndex:i] CGPointValue];