One possible solution to this is in your handlePan method, check the location of the point on the screen and commit this change only if you want to limit it.
For instance,
-(void) handlePan:(UIGestureRecognizer*)panGes{ CGPoint point = [panGes locationInView:self.view];
I believe that this would also correctly handle any screen rotation
EDIT
To move the image in the center of its frame, the handlePan method might look something like this.
-(void)handlePan:(UIPanGestureRecognizer *)gesture { CGPoint point = [gesture locationInView:self.view];
Check if the point is within your desired boundaries, and if so, set the center of the image frame to that point.
source share