2
votes

I am changing my application to universal and want all the views of the iPad to be in landscape mode. My First view is a UIViewController which was added to the window using:

[window addSubview:mainController.view];

Using this view, you can select a button and a navigation controller appears. The navigation controller is added as follows:

[[[UIApplication sharedApplication] keyWindow] addSubview:navigationController.view];

The main view is viewed in landscape mode correctly. However, when I add the navigation controller it is added in portrait mode (IPad is still in landscape, but the navigation controller is flipped). I changed the shouldAutorotate methods to support landscapeLeft while using iPad, changed the iPad IB tableView to be in landscape mode, changed the plist file to be in landscape as well. Did I miss something that causes it to be added in portrait?

Thanks in Advance,

Sami

1
Did you tried by removing mainController before adding navigationCont? I observed that on window only one view at a time work correctly. - Waqas Raja
Just Tried it and It worked. Thanks a lot for the help. - Sami
Not an answer to your question but iPad apps (universal and non-universal) need to support ALL orientations. If not Apple will reject you app (unless it is a game which obviously can't be played portrait and landscape). - user470763
Ohh, I didn't know that. I am glad you told me, thank you very much. - Sami
@kmcgrady - That's not true, I have recently submitted a universal app where the iPad version presents only in landscape, and iPhone version only in Portrait. - CW0007007

1 Answers

0
votes

I see this is old and you say you fixed it, yet it is still marked as unanswered by StackOverflow.

I will add to the discussion that a view controller should only be doing things to its own view. Anything you need to add, push, remove etc should be done from there. The view controller should not be doing things to the window. Good abstractions should focus on what is under them.