IPhone - adding CGPath to NSMutableArray ... how?

When I need to add an integer to an array, I use

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

but what about CGPaths? How to add them to an array?

I need something like

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

any clues? thanks

+6
source share
1 answer

The easiest way, if you can configure iOS 3.2 or higher, is to wrap CGPathRef in UIBezierPath :

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

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

+11
source

Source: https://habr.com/ru/post/890871/


All Articles