10/11/09

CGPoint and other CG variable can store in NSArray

Filed under: iPhone Dev SDK by Tesh @ 15:45

Often is possible that we need to store CG variables in NSArray. You can follow this code to do it.

For example we need to store CGPoints.


NSArray *points = [NSArray arrayWithObjects:
[NSValue valueWithCGPoint:CGPointMake(5.5, 8.3)],
[NSValue valueWithCGPoint:CGPointMake(11.9, 8.5)],
nil];

And when we need to get these points, for example the first point


NSValue *val = [points objectAtIndex:0];
CGPoint p = [val CGPointValue];



No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.