title: How to restrict a moveable view by Pan gesture
body: <p>I have a <code>UIImageView</code> which is moveable via a pan gesture.</p>
  
  <pre><code>UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
  [self.photoMask addGestureRecognizer:pan];
  </code></pre>
  
  <p>I would like to restrict the area this can be moved on screen. Rather than the user be able to drag the view right to the side of the screen, I want to restrict it by a margin of some sort. How can I do this?</p>
  
  <p>Also, how is this then handled when rotated? </p>
  
  <p>EDIT --- </p>
  
  <pre><code>#pragma mark - Gesture Recognizer
  -(void)handlePan:(UIPanGestureRecognizer *)gesture {
      NSLog(@"Pan Gesture");
      gesture.view.center = [gesture locationInView:self.view];
  }
  </code></pre>
  
  <p>This is my current method to handle the pan. What I need to do is continue to move the imageview by the center point and also restrict its movement when close to the edge of the screen by 50 for example.</p>