views:

197

answers:

1

Hi there,

I setup in IB in portrait mode my main view (for iPad). I have a toolbar, a map view (x=0, y=44, w=768, h=774) and a footer view (x=0, y=818, w=768, h=186).

When I rotate the iPad, I want the map to stay on the left side and be resized vertically to fit the view (x=0, y=44, w=756, h=704) and put the footer view on the right side (x=0, y=818, w=768, h=186) and extend vertically too.

Anyway, the effect is exactly the same as the WeatherBug application. I don't know how they do that, but their view containing the information is rotating by 90 degrees with the UIScrollView and UIPageView, I have basically the same needs and really don't know how to make this. Do they have everything in the same xib? I'm so confused...

Please tell me if you know how to do/organize a such view! Thank you...

A: 

If you want the map to stay against the left side and be able to resize vertically set its autoresizingMask as such: mapView.autoresizingMask = UIViewAutoresizingMaskFlexibleRightMargin | UIViewAutoresizingMaskFlexibleHeight;

I don't understand how you want to footerView to resize through (y=818 in landscape mode is out of the visible view).

You should read the UIView reference, specifically the part regarding autoresizing mask (link: http://developer.apple.com/iphone/library/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/UIView/autoresizingMask )

thelaws
Autoresizing mask is not enough. The view is totally different in portrait or landscape. I think I should try this: Creating an Alternate Landscape Interface https://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/BasicViewControllers/BasicViewControllers.html#//apple_ref/doc/uid/TP40007457-CH101-SW26Have you already tried this?
Dachmt
Why I don't get is how can data still be the same in either view... Because it's 2 different view controllers.
Dachmt
No I haven't tried this, I always use one view controller and just resize the subviews to where I want them in the `didRotateFromInterfaceOrientation:` method.
thelaws
That's finally what I am doing. But it doesn't look good and replace the object only at the end of the rotation animation. I resize and replace the subviews in the willAnimateRotationToInterfaceOrientation: instead, and when rotating it does want I want with a better effect. Thanks!
Dachmt