Monday, December 30, 2013

IPHONE call system function problem

I call this class he CGPoint tips CGPoint is not an Object_c class did not mistake what I think is the first document that contains or what,
I also thank you before contact with the platform, how to code,
CGPoint point = [[CGPoint alloc] init];
int mx = point.x;
int my = point.y;

Reply:
CGPoint's look at the definition, you will find CGPoint structure, not a class, so you can not use CGPoint * point = [[CGPoint alloc] init]; way.
CGPoint point; on it,
Of course, if you must use a pointer, then follow the way of the use of c language, (malloc and the like, you should understand what I'm saying)


Reply:
BTW: alloc and init is not a system function is a class member function, in front of a class-level function, followed by an instance level function, the original definition of these two functions in the NSObject class, which is why essentially all of the iphone works The reason the class definition needs to inherit from NSObject class, either directly or indirectly.
Reply:
Point is a structure

No comments:

Post a Comment