Rotate an View iOS swift

Solution:

func didSelectRectSize(sizeValue:Float) {
        let width = CGFloat(sizeValue)
        let height = CGFloat(sizeValue)
        let rotation = atan2(view.transform.bview.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

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift