I\'m trying to rotate an UIView
a few radians but after applying the transformation it doesn\'t look to be keeping its size. What\'s the proper way to achieve t
On Swift 3:
let degrees: CGFloat = -90
let radians = CGFloat(__sinpi(degrees.native/180.0))
view.transform = CGAffineTransform(rotationAngle: radians)
I'm using -90
because of this specific part of the documentation about the rotationAngle
you have to pass to CGAffineTransform
:
The angle, in radians, by which this matrix rotates the coordinate system axes. In iOS, a positive value specifies counterclockwise rotation and a negative value specifies clockwise rotation.