Unfortunately, for you, CGPoint is not an Objective-c object. This is a c-structure. if you double-click Apple on CGPoint, you must go to the definition
struct CGPoint { CGFloat x; CGFloat y; }; typedef struct CGPoint CGPoint;
If you want to save CGPoint to NSArray, you need to wrap them first. You can use NSValue for this or write your own wrapper.
see Convert CGPoint to NSValue
EDIT> There is a small overhead for each call to the Objective-c method, and creating and destroying objects involves many method calls before they are even used for anything. You should not worry about this, as a rule, but for very small objects that encapsulate little behavior and have a short life, this can affect performance. If Apple used objects for all points, corrections, sizes and even functions int, floats, etc. It would be worse.
hooleyhoop Apr 21 '10 at 16:28 2010-04-21 16:28
source share