Rotating UIView using swift task
I would like to rotate a UIView that was defined on the storyboard I was using
CGAffineTransform(rotationAngle: self.degreesToRadians(5))
which grades the transform function in Radians, the rotation works fine, but the only problem is that the UIView is not vector (the edge of the view is not displayed correctly and looks like a saw) like in the screenshot below:
+3
source to share
1 answer
I had the same problems as you and to solve it. I just add the border of the transparent view, do it like this:
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
Add this code after the code rotation
.
+3
source to share