UIbezierpaths in a zoomable view

℡╲_俬逩灬. 提交于 2019-12-04 22:37:31

问题


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!


回答1:


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;




回答2:


You can use CAShapeLayer instead. Just create CAShapeLayer, add CGPath and add a layer as sublayer to your UIView layer



来源:https://stackoverflow.com/questions/11617902/uibezierpaths-in-a-zoomable-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!