views:

54

answers:

1

I am writing an iPad application which uses a menu from a popover to change the view displayed. I have a root view controller which is always present and changes its content view to the sub view controllers, e.g Home, News, etc...

Now here's the problem: Let's say I'm on the Home controller in portrait mode, then go to the news controller, then rotate to landscape, the root controller rotates fine and so does the news controller it contains. But when i go back to the home controller, it is still in portrait mode. The view is rotated to landscape orientation but its size is still in portrait so the width is still (768 px wide). The root view controller which presents all subcontrollers rotates correctly the content view does not rotate if it is not present

How do I fix this? I'm thinking something I could set in viewWillAppear but trying to set the interfaceOrientation forcefully does not work as it is readonly.

Thanks

+1  A: 

Try [self setAutoResizesSubviews:YES] in the viewDidLoad: method on your root view controller.

Edit: I assumed that you have it so, but in Interface Builder, are your views set to autoresize? When you test rotation by hitting the little arrow in the upper right hand corner of the simulated interface, does everything resize correctly? Also, it may be similar to problems people have had with tab bar views auto-rotating. Have you seen this question or this one?

Lastly, if none of that works, you could override layoutSubviews in the root view controller and resize the contained views manually.

Don
you mean [self.view setAutoResizesSubviews]. I tried that but it didn't work. Any other ideas?
Innovative1