Reputation: 2145
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
Upvotes: 0
Views: 499
Reputation: 3812
Nothing seems to work. When device is in landscape mode and all of the content is in landscape mode as well, having the current navigation controller pop the current view and push a new view ALWAYS put the new view and the entire screen content in portrait.
Upvotes: 0
Reputation: 3684
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.
Upvotes: 1