当我使用transform属性旋转UIImageView时,边缘会像素化 [英] When I rotate an UIImageView with the transform property, the edges pixellate
本文介绍了当我使用transform属性旋转UIImageView时,边缘会像素化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
如何在旋转视图上进行抗锯齿处理?
我正在尝试使用这种技术旋转一些UIImageViews:
I'm trying to rotate some UIImageViews using this technique:
imageView.transform = CGAffineTransformMakeRotation(r);
其中r是一个通常介于-0.3和0.3之间的浮点数。
where r is a float usually between -0.3 and 0.3.
问题在于旋转的图像(来自方形jpegs)具有锯齿状边缘(像素化),因为它们在变换后处于一个角度。有没有办法解决这个问题,使边缘平滑(即抗锯齿)?
The problem is that the images (which are derived from square jpegs) that are rotated have jagged edges (pixellation), because they are at an angle after the transform. Is there a way to fix this so the edges are smooth (i.e. antialiased)?
推荐答案
您可以在Info.plist中设置一个启用边缘抗锯齿的键:UIViewEdgeAntialiasing。
There is a key that you can set in Info.plist that enables antialiasing of the edges: UIViewEdgeAntialiasing.
这篇关于当我使用transform属性旋转UIImageView时,边缘会像素化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文