views:

328

answers:

1

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

A: 

sorry I do not have much to add here. I have the almost identical issue. Did you make any progress with it? I was able to get it to scale on rotate to fit the screen correctly by using this...

  float minScale  = [imageScrollView frame].size.width / [zoomView frame].size.width;
    [imageScrollView setMinimumZoomScale:minScale];
    [imageScrollView setZoomScale:minScale];
    [imageScrollView setContentOffset:CGPointZero];

zoomView is the image. imageScrollView is my scrollview.

The problem is that when i switch back to portrait again there is tons of extra space around the image and the image is the wrong size now.

I have been at this for a few days. I would love it if someone could help with this one.

My code is based off the Apple example coded ScrollViewSuite.

blade

olsonvox