开发者

iPhone - adding a CGPath to a NSMutableArray... how?

When I need to add a integer to开发者_C百科 an array I use

[myArray addObject:[NSNumber numberWithInt:myInt]];

but what about CGPaths? How do I add them to the array?

I need something like

"[NSValue valueWithCGPath:myPath]"... ???!!!

any clues? thanks


The easiest way if you can target iOS 3.2 or higher is to wrap the CGPathRef in a UIBezierPath:

[myArray addObject:[UIBezierPath bezierPathWithCGPath:myPath]];

If you need to support earlier iOS versions, you can use a CFArray instead of NSArray because CGPath derives from CFType.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜