0

I have an iPhone app that has several different view controllers. A login screen and then three other view controllers that contain table views. I am using the storyboard, not NIB files, and have designed each view in a portrait orientation on the storyboard. When I run my app, the login screen switches between landscape/portrait when I turn the device and looks just fine. However, the other screens do not change...well, actually they WILL change from landscape to portrait, but they won't change from portrait to landscape. If I am on the login view, then navigate to the other views I can see them in landscape, but as soon as I turn the device and it switches to portrait, it's stuck until I go back to the login screen.

I've searched and found answers that involve NIB files, but nothing about how to work with the device orientation when using the storyboard. Am I missing some property to set on the view? How can I get my table views to work like my login view and automatically switch the orientation automatically?

Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
kschuler
  • 25
  • 1
  • 4

1 Answers1

0

If you want to lock the view orientation in code you lock it with this:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Scott Bossak
  • 2,471
  • 20
  • 17
  • I guess what I really want is the opposite. It's like it's already locked and I'm trying to unlock it. – kschuler Aug 21 '12 at 20:33
  • Silly me. I assumed that because **I** hadn't put that code in there that it wasn't there. But I guess when I created the view controller Xcode must have automatically created that method?...or maybe I copied it from some sample I was working with and didn't realize. Anyway, I guess I was locking it and didn't realize it. Thanks for your help! – kschuler Aug 21 '12 at 21:03