title: How Can I Rotate A UIImage and Image Data By 90 Degrees
body: <p>I have a UIImageView that contains an image. At the minute the user can click to save the image within the UIImageView to disk. </p>
  
  <p>I would like to make it so that the the user can click to rotate the UIImageView and also rotate the UImage within the view so that when the image is saved it keeps the new rotation.</p>
  
  <p>At the minute I have </p>
  
  <pre><code>- (IBAction)rotateImage:(id)sender {
  
  float degrees = 90; //the value in degrees
  self.imagePreview.transform = CGAffineTransformMakeRotation(degrees * M_PI/180);
  
  }
  </code></pre>
  
  <p>Can someone point me in the right direction regarding keeping the current rotation.</p>
  
  <p>Thanks</p>