gpt4 book ai didi

ios - UIView 旋转使用 swift 问题

转载 作者:搜寻专家 更新时间:2023-10-31 22:27:26 24 4
gpt4 key购买 nike

我想旋转在我使用的 Storyboard上定义的 UIView

CGAffineTransform(rotationAngle: self.degreesToRadians(5))

which degreesToradians 是一个转换为弧度的函数,旋转效果很好,但唯一的问题是 UIView 不是矢量的( View 的边缘没有正确渲染,看起来像锯子),如下面的屏幕截图所示:

enter image description here

最佳答案

我遇到了和你一样的问题,为了解决它,我只是在透明的 View 中添加了一个边框,这样做是这样的:

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 代码之后添加该代码。

使用代码:
enter image description here

没有代码:
enter image description here

关于ios - UIView 旋转使用 swift 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44410980/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com