title: reset view rotation angle to zero in swift ios
body: <p>I'm able to rotate UIView by 90 degree and also able to get rotation angle.</p>
  
  <p>Need to implement--->reset myView rotation angle value to 0  but view position/direction should not go previous rotation/position value on UI and then if i rotate it has to start rotate from same position/direction and it's rotation angle need to start from 0.
  <a href="https://i.stack.imgur.com/MCeMB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MCeMB.png" alt="enter image description here"></a>  </p>
  
  <p>I rotated view 90 degree by tapping on rotate button as below screen.
  <a href="https://i.stack.imgur.com/OlVh1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OlVh1.png" alt="enter image description here"></a></p>
  
  <p>Here is the implementation code</p>
  
  <pre><code>    @IBOutlet weak var myView: UIView!
  @IBAction func rotateBtn(_ sender: Any) {
      myView.transform = myView.transform.rotated(by: .pi/2)
      getRotateAngles()
  }
  func getRotateAngles() {
      let radians = atan2(myView.transform.b, myView.transform.a)
      var degrees = radians * 180 / .pi
      degrees.round()
      let realDegrees = degrees &gt;= 0 ? abs(degrees) : 360 + degrees
      print("Degrees:: \(realDegrees)")
  }
  @IBAction func saveTapped(_ sender: Any) {
      myView.transform = .identity //need to implement---&gt;reset myView rotation angle value to 0  but view position/direction should not go previous rotation value on UI and then if i rotate it has to start rotate from same position/direction and it's rotation angle need to start from 0.
  }
  </code></pre>
  
  <p>Here i can able to print view rotated degrees in 0, 90, 180, 270, 0.....</p>
  
  <p>how can i able to reset view rotation value to 0 when save is tapped. </p>
  
  <p>Coming to UI part if view is rotated 90 degrees and tapped on save view will be same on UI but the degrees value should start from 0.</p>
  
  <p>if i keep transform identity myView is changing it's position on UI this is the issue. i don't want change it's place/position on UI but only view degrees should start from 0 when saveTapped.</p>
  
  <p><strong>FOR EXAMPLE:</strong> I rotated view it gives degrees 0, 90, 180, 270, 0... 
  The requirement is i rotated view it prints degress 90. saveTapped then myView should be at same position/same place no change on UI. Now when i rotate again it has to print degrees 0, 90, 180, 270, 0....but in this case saveTapped and view is rotated 90 degree already </p>
  
  <p>Thanks in advance.</p>