iPhone SDK: How to centre content in a UIScrollView during setZoomScale?

Posted by Russell Quinn on Stack Overflow See other posts from Stack Overflow or by Russell Quinn
Published on 2010-03-19T20:56:09Z Indexed on 2010/03/19 21:01 UTC
Read the original article Hit count: 617

Filed under:
|
|

I'm using a UIScrollView to show photos. If they are zoomed out so they are smaller than the scroll view in one dimension then the content is centred using contentInset and contentOffset. This all works fine for scrolling and manual zooming.

However, if I use setZoomScale (with animated YES) then when zooming out the scroll view sets the top left edge to 0,0 during the animation and then snaps it back afterwards. It seems like the zoom animation ignores the contentInset and contentOffset settings.

Does anyone have any idea how to overcome this problem?

Thanks,

Russell.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk