title: Not able to move two images using uipangesturerecogniser
body: <p>I want to move two images with same <code>UIPanGestureRecognizer</code> , 
  I am able to move the <strong>first</strong> image, but as soon as I try to move the <strong>second</strong> image the first one goes back to its original position. I want the first image to retain it's after changed position.</p>
  
  <pre><code>-(void) viewWillAppear:(BOOL)animated
  {
      UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self      action:@selector(handlePanSuper:)];
      [self.view addGestureRecognizer:pan];
  }
  
  - (void)handlePanSuper:(UIPanGestureRecognizer *)sender
      {
       static UIImageView *viewToMove;
       static CGPoint  originalCenter;
  
      if (sender.state == UIGestureRecognizerStateBegan)
      {
      CGPoint location = [sender locationInView:self.view];
  
      if (CGRectContainsPoint(self.imageView.frame, location))
      {
          viewToMove = imageView;
          originalCenter = viewToMove.center;
      }
      else if (CGRectContainsPoint(self.image2.frame, location))
      {
          viewToMove = image2;
          originalCenter = viewToMove.center;
      }
      else
      {
          viewToMove = nil;
      }
  
      if (viewToMove)
      {
  
          viewToMove.alpha = 0.8;
          [viewToMove.superview bringSubviewToFront:viewToMove];
          NSLog(@"hi i am being touched.");
       }
   }
   if (sender.state == UIGestureRecognizerStateChanged &amp;&amp; viewToMove != nil)
      {
      CGPoint translation = [sender translationInView:self.view];
      viewToMove.center = CGPointMake(originalCenter.x + translation.x, originalCenter.y +                                        translation.y);
  
  
  }
  else if ((sender.state == UIGestureRecognizerStateEnded ||
            sender.state == UIGestureRecognizerStateFailed ||
            sender.state == UIGestureRecognizerStateCancelled) &amp;&amp; viewToMove != nil)
  {
      // do whatever post dragging you want, e.g.
      // snap the piece into place
  
         // CGPoint center = viewToMove.center;
          //viewToMove.center = center;
  
          viewToMove.alpha  = 1.0;
  
          viewToMove = nil;
    }
  }
  </code></pre>