Note that there are some explanatory texts on larger screens.

plurals
  1. POLandscape only iPhone app with multiple nibs
    text
    copied!<p>I'm developing an iPhone application that has several nibs, and should be landscape only.</p> <p>The application is set to start in landscape mode via its Info.plist file.</p> <p>I have two view controllers: <code>FirstViewController</code> and <code>SecondViewController</code>.</p> <p>For each of these I have a nib file, where the view is in landscape. Both view controllers are added to my <code>MainView</code> nib as outlets, and their views are lazily initialized.</p> <p>When the application loads, the first view displays in landscape, as expected. However, when I switch to the second view, the device (or simulator) remains in landscape, but the view is rotated, as if the device were in portrait mode, braking my interface.</p> <p>In both <code>UIViewController</code> classes I have the following code:</p> <pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return interfaceOrientation == UIInterfaceOrientationLandscapeRight; } </code></pre> <p>and to switch views, in my app delegate I'm doing:</p> <pre><code>[viewController.view removeFromSuperview]; [window addSubview:secondViewController.view]; </code></pre> <p>where <code>viewController</code> and <code>secondViewController</code> are the two outlets where the view controllers are connected.</p> <p>This is how the second view looks in IB: <a href="http://img27.imageshack.us/img27/4898/picture1ni.png">alt text http://img27.imageshack.us/img27/4898/picture1ni.png</a></p> <p>and this is how it looks in the simulator: <a href="http://img402.imageshack.us/img402/4866/picture2wt.png">alt text http://img402.imageshack.us/img402/4866/picture2wt.png</a></p> <p>Why is that the second view is displaying in landscape but with the interface rotated?</p> <p>I wouldn't like to deal with transform properties, since that seems overkill.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload