khose
khose

Reputation: 763

Convert CGPath points to a different UIView reference

I'm facing a problem I'm not sure how to solve. I have a CGPath defined for a specific view, using that view's bounds. Another view needs to make use of that path but of course, the coordinates are not right (according to the second view's layer). So I was hoping to find something like:

[view2 convertPoint:view1.center fromView:view1];

but converting a CGPath instead of a point.

Is there any equivalent? Is that even possible? Thanks!

Upvotes: 1

Views: 692

Answers (1)

psci
psci

Reputation: 933

As far as I know, there is no function for convenient transform CGPath between views coordinating system, but you can use CGPathCreateCopyByTransformingPath and apply affine transforms like CGAffineTransformScale and CGAffineTransformTranslate

Upvotes: 3

Related Questions