title: how to set a rotated image as the image of a UIImageView after triggering UIRotationGesture?
body: <p>I am creating an app, in which users can rotate an imageView on the screen, which will be saved as a UIImage for the next phase programatically. I have implemented all the required methods for rotating, which is done through UIRotationGesture, and everything works fine. The problem I have is that the rotation is not recorded for the image when I go to the next phase, and show the image in another view. I tried to add the gestureRecognizer to the UIImage of imageView, but I realised I can't do so. I also had a look at the <a href="https://stackoverflow.com/questions/9021789/reset-view-after-uirotationgesture">Reset view after UIRotationGesture</a> thread, and I think I'm having this problem because I haven't stored something, but as I'm new, I don't know what and how. 
  here's the code I used to rotate:</p>
  
  <pre><code>-(void)handleRotation:(UIRotationGestureRecognizer *)rotationGestureRecognizer
  {
  
      if([rotationGestureRecognizer state] == UIGestureRecognizerStateEnded) {
  
      lastRotation = 0.0;
      return;
  }
  
  CGFloat rotation = 0.0 - (lastRotation - [rotationGestureRecognizer rotation]);
  
  CGAffineTransform currentTransform = [rotationGestureRecognizer view].transform;
  CGAffineTransform newTransform = CGAffineTransformRotate(currentTransform,rotation);
  
  [[rotationGestureRecognizer view] setTransform:newTransform];
  
  lastRotation = [rotationGestureRecognizer rotation];
  }
  </code></pre>
  
  <p>I'd appreciate it if anyone could shed a light on my problem.</p>
  
  <p>Thanks a lot</p>