Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIbezierpaths in a zoomable view

I draw bezierpaths in a zoomable UIView (drawing layer of a pdf reader). When I zoom in the document the UIView zoom in too, but then all the drawings and lines looks much more pixelated. Is there a way to render those paths without too much pixelation? It supposed that bezier paths are vectorial based...

Thanks in advance!

like image 893
Samui Avatar asked Jul 23 '12 17:07

Samui


1 Answers

You are correct that a UIBezierPath is vector based. However, when you draw a path into a view, it uses the contentScale property on the views layer to determine the amount of detail to use when drawing.

What you could do is when the user finishes zooming, set the content scale to the correct amount.

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

like image 176
Craig Siemens Avatar answered Sep 22 '22 13:09

Craig Siemens