title: Scale, rotate and drag UIImageView
body: <pre><code>-(void)scale:(id)sender {
  
  [self.view bringSubviewToFront:[(UIPinchGestureRecognizer*)sender view]];
  
  if([(UIPinchGestureRecognizer*)sender state] == UIGestureRecognizerStateEnded) {
  
      lastScale = 1.0;
      return;
  }
  
  CGFloat scale = 1.0 - (lastScale - [(UIPinchGestureRecognizer*)sender scale]);
  
  CGAffineTransform currentTransform = [(UIPinchGestureRecognizer*)sender view].transform;
  CGAffineTransform newTransform = CGAffineTransformScale(currentTransform, scale, scale);
  
  [[(UIPinchGestureRecognizer*)sender view] setTransform:newTransform];
  
  lastScale = [(UIPinchGestureRecognizer*)sender scale];
  }
  
  -(void)rotate:(id)sender {
  
  [self.view bringSubviewToFront:[(UIRotationGestureRecognizer*)sender view]];
  
  if([(UIRotationGestureRecognizer*)sender state] == UIGestureRecognizerStateEnded) {
  
      lastRotation = 0.0;
      return;
  }
  
  CGFloat rotation = 0.0 - (lastRotation - [(UIRotationGestureRecognizer*)sender rotation]);
  
  CGAffineTransform currentTransform = [(UIPinchGestureRecognizer*)sender view].transform;
  CGAffineTransform newTransform = CGAffineTransformRotate(currentTransform,rotation);
  
  [[(UIRotationGestureRecognizer*)sender view] setTransform:newTransform];
  
  lastRotation = [(UIRotationGestureRecognizer*)sender rotation];
  }
  
  -(void)move:(id)sender {
  
  [[[(UITapGestureRecognizer*)sender view] layer] removeAllAnimations];
  
  [self.view bringSubviewToFront:[(UIPanGestureRecognizer*)sender view]];
  CGPoint translatedPoint = [(UIPanGestureRecognizer*)sender translationInView:self.view];
  
  if([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateBegan) {
  
      firstX = [[sender view] center].x;
      firstY = [[sender view] center].y;
  }
  
  translatedPoint = CGPointMake(firstX+translatedPoint.x, firstY+translatedPoint.y);
  
  [[sender view] setCenter:translatedPoint];
  
  if([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateEnded) {
  
      CGFloat finalX = translatedPoint.x + (.35*[(UIPanGestureRecognizer*)sender velocityInView:self.view].x);
      CGFloat finalY = translatedPoint.y + (.35*[(UIPanGestureRecognizer*)sender velocityInView:self.view].y);
  
      if(UIDeviceOrientationIsPortrait([[UIDevice currentDevice] orientation])) {
  
          if(finalX &lt; 0) {                                finalX = 0;             }                       else if(finalX &gt; 768) {
  
              finalX = 768;
          }
  
          if(finalY &lt; 0) {                                finalY = 0;             }                       else if(finalY &gt; 1024) {
  
              finalY = 1024;
          }
      }
  
      else {
  
          if(finalX &lt; 0) {                                finalX = 0;             }                       else if(finalX &gt; 1024) {
  
              finalX = 768;
          }
  
          if(finalY &lt; 0) {                                finalY = 0;             }                       else if(finalY &gt; 768) {
  
              finalY = 1024;
          }
      }
  
      [UIView beginAnimations:nil context:NULL];
      [UIView setAnimationDuration:.35];
      [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
      [[sender view] setCenter:CGPointMake(finalX, finalY)];
      [UIView commitAnimations];
  }
  }
  
  -(void)tapped:(id)sender {
  
  [[[(UITapGestureRecognizer*)sender view] layer] removeAllAnimations];
  }
  
  - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer      shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
  
  return ![gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]];
  }
  </code></pre>
  
  <p>This is my code and the UIImageView I want to move is called "Birdie". I know I have to create a -(void)Birdie UIImageView recognizer but I used the following which didn't worked.</p>
  
  <pre><code>    UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(scale:)];
  [pinchRecognizer setDelegate:self];
  [Birdie addGestureRecognizer:pinchRecognizer];
  
  UIRotationGestureRecognizer *rotationRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotate:)];
  [rotationRecognizer setDelegate:self];
  [Birdie addGestureRecognizer:rotationRecognizer];
  
  UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move:)];
  [panRecognizer setMinimumNumberOfTouches:1];
  [panRecognizer setMaximumNumberOfTouches:1];
  [panRecognizer setDelegate:self];
  [Birdie addGestureRecognizer:panRecognizer];
  
  UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];
  [tapRecognizer setNumberOfTapsRequired:1];
  [tapRecognizer setDelegate:self];
  [Birdie addGestureRecognizer:tapRecognizer];
  
  [self.view addSubview:Birdie];
  }
  </code></pre>
  
  <p>Thanks alot in advanced!!</p>