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
.
精彩评论