0

I am having a issue with story board where if my app is a landscape app I then add a new view (ViewB), on ViewA I add a button and then I drag the button click to view B. When I run the app its starts in landscape but when I click the button it goes into portrait mode. I picked Landscape under the simulated metrics options on both views but that does not seem to help. Do I have to pick a certain style under the Storyboard Segue (Modal, Push...). What am I doing wrong, and How can I fix it so it stays in Landscape all the time?

user964627
  • 655
  • 3
  • 14
  • 24

2 Answers2

2

The orientation in which you view your simulated metrics in the nib or storyboard has nothing, repeat nothing, to do with the orientation in which your views appear in the running app. All you're doing in the nib or storyboard is turning the canvas so you can see what you're doing in a better way.

Automatic view rotation is entirely the purview of UIViewController. It is dictated entirely in code. You'll want to read the UIViewController documentation, and/or read the section in my book on rotation:

http://www.apeth.com/iOSBook/ch19.html#_rotation

matt
  • 515,959
  • 87
  • 875
  • 1,141
0

Check these two things:

  1. Your view controller should implement the method:

    • (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); }
  2. You should edited your project summary page selecting the desired "Supported Device Orientations".

T.J.
  • 3,942
  • 2
  • 32
  • 40