title: Need to restrict movement of UIImageView to region covered by UITableView using UIPanGestureRecognizer in iOS
body: <p>I am currently moving a UIImageView using a UIPanGestureRecognizer object in my app.  At present, this UIImageView is moving up and down very nicely on my screen.  However, what I would like to do now is restrict the boundary of the UIImageView's movement to within the region covered by my UITableView that resides in the middle of the screen.  I want to restrict this movement to both the upper, and lower borders of the UITableView.  Here is my relevant method where I control the movement of my UIImageView:</p>
  
  <pre><code>- (void)panGestureDetected:(UIPanGestureRecognizer *)recognizer {
  
      _startLocation = [recognizer locationInView:_imageView];
  
      NSLog(@"The point is: %d", _startLocation);
  
      CGPoint newCenter  = _imageView.center;
  
      newCenter.y = [recognizer locationInView:[_imageView superview]].y;
  //this is where I figure I need to include an if statement to perform a check to see if the location is within the desired region
  
      _imageView.center = newCenter;
  
  
  }
  </code></pre>
  
  <p>I realize that I will need to include an "if" statement within my method to check to see if my UIImageView is within my desired region, but the problem is that I am not sure how to check for this.  Can someone help me out here?</p>