UIScrollView issue with autorotation and content scaling

Posted by boliva on Stack Overflow See other posts from Stack Overflow or by boliva
Published on 2010-05-07T08:12:58Z Indexed on 2010/05/07 8:18 UTC
Read the original article Hit count: 760

Filed under:
|
|
|
|

Hi,

I'm building a new (autorotating) iPad app that consists mainly of a screen sized UIScrollView that contains an UIImageView for an image which is 5 times the iPad screen resolution while in portrait mode (3840x1024).

What I haven't been able to accomplish is that whenever the device rotates (to whichever orientation) the imageView bounds and the scrollView contentSize asjusts the image for the new height (maintaining its aspect ratio), making the height of the image to always fit the device height for the given orientation (so in the particular case of this image, it would get shown as 2880x768).

I tried different combinations of autoresizingMask and contentMode for the imageView but the closer I've been able to get is to effectively display the image at the desired size but with a white padding around it and into the scrollView content (to make up for the original orientation contentSize). I also tried recalculating the scrollView contentSize in the didRotate.../viewWillAnimate... rotation-related methods in my viewController class, with no avail.

Best regards and thanks for your time

© Stack Overflow or respective owner

Related posts about ipad

Related posts about uiscrollview