title: How to use UIPanGestureRecognizer to move object? iPhone/iPad
body: <p>There are several examples of the <code>UIPanGestureRecognizer</code> class. For example I have read <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPanGestureRecognizer_Class/Reference/Reference.html#//apple_ref/occ/cl/UIPanGestureRecognizer" rel="noreferrer">this</a> and I am still not able to use it...</p>
  
  <p>On the nib file that I am working on I have a <code>UIView</code> (white rectangle on image) that I wish to drag with that class:</p>
  
  <p><img src="https://i.stack.imgur.com/DYBkS.png" alt="enter image description here"></p>
  
  <p>and in my .m file I have placed:</p>
  
  <pre><code>- (void)setTranslation:(CGPoint)translation inView:(UIView *)view
  {
      NSLog(@"Test to see if this method gets executed");
  }
  </code></pre>
  
  <p>and that method does not get executed when I drag the mouse across the <code>UIView</code>. I have also tried placing:</p>
  
  <pre><code>- (void)pan:(UIPanGestureRecognizer *)gesture
  {
      NSLog(@"testing");
  }
  </code></pre>
  
  <p>And that method does not get executed either. Maybe I am wrong but I think this methods should work like the <code>- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event</code> method where I just have to place that method and it will get called whenever there are touches. </p>
  
  <p>What am I doing wrong? Maybe do I have to draw a connection to that method? If so how can I do that? </p>