Rotate an View iOS swift
Solution:
func didSelectRectSize(sizeValue:Float ) {
let width = CGFloat(sizeValue)
let height = CGFloat(sizeValue)
let rotation = atan2(view.transform.b, view.transform .a)
let angles = view.transform
var transform = CGAffineTransform.init(scaleX: CGFloat(sizeValue), y: CGFloat(sizeValue))
view.transform = transform
view.transform = view.transform .rotated(by: rotation)
}
func didSelectRotate(rotateValue:Float ) {
view.transform = CGAffineTransform(rotationAngle: CGFloat(Double(exactly: rotateValue)! * 2 * M_PI / 360))
}
Comments
Post a Comment