title: how to limit UIPanGestureRecognizer with in parent view
body: <p>Hi i have used<code>UIPanGestureRecognizer</code> in my project. i used below code to handle <code>UIPanGestureRecognizer</code></p>
  
  <pre><code>- (void)handlePan:(UIPanGestureRecognizer *)recognizer {
  
        CGPoint translation = [recognizer translationInView:self];
        CGFloat newX = MIN(recognizer.view.frame.origin.x + translation.x, self.frame.size.width - recognizer.view.frame.size.width);
        CGRect newFrame = CGRectMake( newX,recognizer.view.frame.origin.y, recognizer.view.frame.size.width, recognizer.view.frame.size.height);
        recognizer.view.frame = newFrame;
        [recognizer setTranslation:CGPointZero inView:self];
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/nfvKn.png" alt="enter image description here"></p>
  
  <p>i have two views in my project one is parent view(Red color view) and another one is child view (Green color view). My requirement is i need to pan the child view with in parent view. My <code>handlePan</code> method working fine but the only problem is its allowing to pan beyond the limit in left side. its working perfectly in right side. what i need to change in code Please help me out.</p>