How to keep imageview inside UIView when moving imageview?
<p>I have an UIView inside main view controller which contain 1 imageview.i moved imageview with this method.</p>

<pre><code> - (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
   UITouch *aTouch = [touches anyObject];
   if (aTouch.view == self.sub_View) {
    CGPoint location = [aTouch locationInView:self.sub_View];
    CGPoint previousLocation = [aTouch previousLocationInView:self.sub_View];
    self.imageView.frame = CGRectOffset(self.imageView.frame, (location.x - previousLocation.x), (location.y - previousLocation.y));
    }
}
</code></pre>

<p>Imageview move perfect. But i have to keep imageview inside UIView when i moved. Problem with this code is when i move imageview it is also moved outside UIView. I have to keep imageview inside UIView and movable only inside UIView.
Please help me to solve this. How to set boundary for imageview so it is movable only inside UIView.</p>