Question: I have a UIView object that can be dragged around using UIPanGestureRecognizer, but I only want it to be able to move up 3/4 of the screen. I don't want to it be clipped, but to get to a certain point and not be able to be dragged any further. What I have so far allows it to only move on the Y axis (which is desired).

```
- (IBAction)panGesture:(UIPanGestureRecognizer *)recognizer
{
  CGPoint translation = [recognizer translationInView:self.view];
  recognizer.view.center = CGPointMake(recognizer.view.center.x, 
                                       recognizer.view.center.y + translation.y);
  [recognizer setTranslation:CGPointMake(0, 0) inView:self.view];
}

```

Thanks for any help.

Answer: 
So just check whether the new Y coordinate would be too small. Don't change the view if it would be too small:

```
- (IBAction)panGesture:(UIPanGestureRecognizer *)recognizer
{
  CGPoint translation = [recognizer translationInView:self.view];
  [recognizer setTranslation:CGPointMake(0, 0) inView:self.view];

  CGPoint center = recognizer.view.center;
  center.y += translation.y;
  if (center.y < self.yMin)
    return;
  recognizer.view.center = center;
}

```
Implement the following gesture delegate and check your condition inside it. Returning YES or NO from this delegate will make the gesture active and inactive.

```
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch;

```