title: UILongPressGestureRecognizer
body: <p>I am trying to create an app where UIButtons can be draged and dropped when a UILongPressGestureRecognizer gesture is fired.</p>
  
  <p>I have:</p>
  
  <pre><code>UIGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]
  initWithTarget:self action:@selector(handleLongPress:)];
  </code></pre>
  
  <p>And </p>
  
  <pre><code>- (void)handleLongPress:(UILongPressGestureRecognizer *)recognizer {
      CGPoint location = [recognizer locationInView:self.view];
  
      switch (recognizer.state) {
          case UIGestureRecognizerStateBegan:
              //NSLog(@"handleLongPress: StateBegan");
              break;
          case UIGestureRecognizerStateChanged:
              if(location.y &gt; 75.0 &amp;&amp; location.x &gt; 25 &amp;&amp; location.x &lt; 300)
                  button.frame = CGRectMake(location.x-25, location.y-15, 50, 30);           
              break;
          case UIGestureRecognizerStateEnded:
              //NSLog(@"handleLongPress: StateEnded");
              break;
          default:
              break;
      }   
  }
  </code></pre>
  
  <p>This works great with one button (namely the ivar <code>button</code>). How can I send to the handleLongPress function the current button that is being pressed? In other words, I would like to do something like the following where I pass in <code>sender</code></p>
  
  <pre><code>- (void)handleLongPress:(UILongPressGestureRecognizer *)recognizer:(id)sender {
      CGPoint location = [recognizer locationInView:self.view];
  
      switch (recognizer.state) {
          case UIGestureRecognizerStateBegan:
              //NSLog(@"handleLongPress: StateBegan");
              break;
          case UIGestureRecognizerStateChanged:
              if(location.y &gt; 75.0 &amp;&amp; location.x &gt; 25 &amp;&amp; location.x &lt; 300)
                  sender.frame = CGRectMake(location.x-25, location.y-15, 50, 30);           
              break;
          case UIGestureRecognizerStateEnded:
              //NSLog(@"handleLongPress: StateEnded");
              break;
          default:
              break;
      }   
  }
  </code></pre>