UIbezierpaths在可缩放的视图中 [英] UIbezierpaths in a zoomable view

查看:153
本文介绍了UIbezierpaths在可缩放的视图中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在可缩放的UIView(pdf阅读器的绘图层)中绘制bezierpaths。当我放大文档时,UIView也会放大,但是所有的绘图和线条看起来都更加像素化了。有没有办法在没有太多像素化的情况下渲染这些路径?它假设贝塞尔路径是基于矢量的......

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...

提前致谢!

推荐答案

UIBezierPath是基于向量的,这是正确的。但是,当您在路径中绘制路径时,它会使用视图图层上的 contentScale 属性来确定绘制时要使用的详细信息量。

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;

这篇关于UIbezierpaths在可缩放的视图中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆