Search code examples
objective-ciosuiviewzoominguipinchgesturerecognizer

Zooming the whole screen with UIPinchGestureRecognizer


I was trying to add a pinch gesture zoom-in zoom-out feature to a UITextView and then I decided that adding a pinch gesture which zooms the whole screen, covering the whole view hierarchy is a better and more general solution. But I am confused about how to do it: Should I change the frame sizes of all UIView objects or should I somehow scale them? What is the most correct way to do it?


Solution

  • Put all your views in a UIScrollView and then return the view in this delegate method of UIScrollView

    - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView