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