标签: ios swift rotation cgaffinetransform
我想轮换在我使用的故事板上定义的UIView
CGAffineTransform(rotationAngle: self.degreesToRadians(5))
其中degreeToradians是一个转换为Radians的函数,旋转工作完美,但唯一的问题是UIView不是矢量(视图的边缘没有正确渲染,看起来像锯),如下面的截图所示: / p>
答案 0 :(得分:3)
我遇到了和你一样的问题并解决了它我只是在视图中添加一个透明的边框,就像这样:
customView.layer.borderWidth = 1 customView.layer.borderColor = UIColor.clear.cgColor // important that it is clear customView.layer.shouldRasterize = true customView.layer.rasterizationScale = UIScreen.main.scale
在rotation代码后添加该代码。
rotation
代码:
没有代码: