开发者

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

开发者 https://www.devze.com 2023-03-13 20:10 出处:网络
When I need to add a integer to开发者_C百科 an array I use [myArray addObject:[NSNumber numberWithInt:myInt]];

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

精彩评论

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