1

I am using this method to scale an imageView.

-(IBAction)handlePinching:(UIPinchGestureRecognizer *)recognizer {
  recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale,recognizer.scale);
  recognizer.scale = 1;
}

How do I prevent my imageView from scaling outside of self.view? I don't want any part of of my imageView to ever scale outside of the self.view.

CrazyGoose
  • 51
  • 1
  • 10

1 Answers1

0

Set clipsToBounds to YES on your view to prevent any drawing of subviews outside the bounds of your view:

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.view.clipsToBounds = YES;
}
TylerP
  • 9,600
  • 4
  • 39
  • 43