How to zoom a UIScrollView programmatically the exact same way as one I'm manually zooming

Stephen J. picture Stephen J. · Jul 12, 2011 · Viewed 8.5k times · Source

I have 2 UIScrollViews side by side, and a feature I'm working on is the ability to pinch and zoom on 1 UIScrollView, and have the other one next to it respond in the EXACT same way as the one I'm tapping. Of particular interest is zooming in on the same area that the other UIScrollView is zooming in on. It's one thing to just set the zoomScale, but it's another to mimic the zoom behavior exactly.

How can I do this?

Answer

Tirth picture Tirth · Jul 12, 2011

Use following method it will help you,

- (void)zoomToRect:(CGRect)rect animated:(BOOL)animated

In above method you have pass only rect of your view it will zooming inside that rect.

for additional information please read documentation.