2
votes
objective c - Resizing CAShapeLayer - Stack Overflow
Asked
Viewed 2k times
2

I have a simple test app on which my rootViewController's UIView contains a bunch of UIView subviews. Each one of those UIView subview is backed by a CAShapeLayer.

I want the composition created by those subviews ( the four shapes that are within the dotted area .. ) to always stay vertically and horizontally centered with respect to my UIWindow. (the minimium size of the left/right, top/bottom margins will be subject to be changed at runtime at each orientation change )

So for example when i rotate to portrait i will have to resize and reposition those single shapes so that the whole figure will be mantained centered and each CAShapeLayer sublayer stays sharp ( i want their path to be resized not just a raster resize )

what would be the best technique to resize/move the shapes to always have a centered composition while maintaining path crisp appearance for the shapes?

Ultimately for me it will be good to have an answer to this: how can i shrink the subviews as a whole? i mean their sizes and relative positions?

Thanks

1
  • Did you figure it out? Do you use a transform? And if, how does it look like?
    – Jan
    Jan 9 2015 at 10:46
1

You can use CGPathCreateMutableCopyByTransformingPath() or -[UIBezierPath applyTransform:] to recalculate all points in the path.

0

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

    Not the answer you're looking for? Browse other questions tagged or ask your own question.

     
    1
    Did you figure it out? Do you use a transform? And if, how does it look like?Jan

    1 Answers

    1
    votes

    You can use CGPathCreateMutableCopyByTransformingPath() or -[UIBezierPath applyTransform:] to recalculate all points in the path.