Slider based view rotation iOS swift

 Solution:

The below function used for rotate one view and it will not affect the scaling in that view

  func didRotate(rotateValue:Float) {

    let trans = myView.transform

//backup scaling

    let scaling = sqrt(trans.a * trans.a + trans.c * trans.c)

    let transform = CGAffineTransform.init(scaleX: scaling, y: scaling)

    myView.transform = transform

//apply both scaling and rotation    

    myView.transform = aceView.draggableTextView.transform.rotated(by: CGFloat(Double(exactly: rotateValue)! * Double.pi / 180))


  }

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

store cgpoint in userdefaults iOS swift