UIbezierpaths scalable

I draw bezierpaths in a scalable UIView (drawing layer of a PDF reader). When I zoom in on the document, the UIView image also zooms in, but then all the drawings and lines look much more uneven. Is there a way to render these paths without too much pixelation? He suggested that the bezier trajectories are vector ...

Thanks in advance!

+4
source share
2 answers

You are right that UIBezierPath is vector based. However, when you draw the view path, it uses the contentScale property at the view level to determine the amount of detail to use when drawing.

What can you do when the user finishes scaling, set the content scale to the correct amount.

drawingView.layer.contentScale = [[UIScreen mainScreen] scale] * zoomAmount;

+8
source

Instead, you can use CAShapeLayer . Just create a CAShapeLayer, add a CGPath and add a layer as a sublevel to your UIView layer

0
source

All Articles