2

I can get the UIPinchGestureRecognizer handler to work with scaling an object but I don't want to scale I want to change the size. For example I have a UIView and I've attacked a UIPinchGestureRecognizer gesture to it and if the user pinches I want to change the width of the UIView to match the pinch. I don't want to scale it so the UIView is larger(zooming)

Pranjal Bikash Das
  • 1,092
  • 9
  • 27
  • 1
    You can calculate the new size by multiplying the current frame by the zoom ratio. –  Dec 12 '12 at 13:48

1 Answers1

-2

If you have the UIPinchGestureRecognizer call a method pinch, you can do:

- (void) pinch:(UIPinchGestureRecognizer *)pinch
{
    CGRect frame = [self.view frame];
    frame.size.width = frame.size.width * pinch.scale;
    [self.view setFrame:frame];
}
Mattias Farnemyhr
  • 4,148
  • 3
  • 28
  • 49