title: Animate a rotated label in swift?
body: <p>I am trying to animate a rotated label like this:</p>
  
  <pre><code>@IBOutlet fileprivate weak var loadingLabel: UILabel!
  
      override func viewDidAppear(_ animated: Bool) {
          super.viewDidAppear(animated)
  
          loadingLabel.transform = CGAffineTransform(rotationAngle: CGFloat(0.2))  // rotation line
  
          UIView.animate(withDuration: 2.0, animations: {
              self.loadingLabel.transform = CGAffineTransform(translationX: 0, y: self.view.bounds.size.height)
          })
      }
  </code></pre>
  
  <p>When I comment out the rotation line of code (and keep the label unrotated), it works fine. But when I rotate it, the label starts off the screen at the beginning of the animation:
  <a href="https://i.stack.imgur.com/XK028.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XK028.png" alt="enter image description here"></a></p>
  
  <p>When I comment out the animation, the label is rotated perfectly fine (but no animation obviously):
  <a href="https://i.stack.imgur.com/iWh3O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iWh3O.png" alt="enter image description here"></a></p>
  
  <p>How do I rotate the image and animate it, without having this weird placement?</p>
  
  <p>Edit: To clarify: I want the label to start off rotated in the center of the screen, and just simply move the label. I do not want to rotate the image during the animation.</p>