When I rotate an UIImageView with the transform property, the edges pixellate [duplicate]

走远了吗. 提交于 2019-12-06 03:38:35

问题


Possible Duplicate:
How to do antialiasing on a rotated view?

I'm trying to rotate some UIImageViews using this technique:

imageView.transform = CGAffineTransformMakeRotation(r);

where r is a float usually between -0.3 and 0.3.

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)?


回答1:


There is a key that you can set in Info.plist that enables antialiasing of the edges: UIViewEdgeAntialiasing.

http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html



来源:https://stackoverflow.com/questions/7080325/when-i-rotate-an-uiimageview-with-the-transform-property-the-edges-pixellate

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