How to restrict a moveable view by Pan gesture
问题 I have a UIImageView which is moveable via a pan gesture. UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; [self.photoMask addGestureRecognizer:pan]; I would like to restrict the area this can be moved on screen. Rather than the user be able to drag the view right to the side of the screen, I want to restrict it by a margin of some sort. How can I do this? Also, how is this then handled when rotated? EDIT --- #pragma mark -