optionsix
optionsix

Reputation: 956

iOS Storyboarding segue action changes orientation incorrectly

Okay so I'm new to the whole storyboarding functionality in iOS 5. I have an application for iPad that is locked into landscape mode. Just to test out the seguing functionality, I took my initial view controller, added a button, dragged a new view controller next to it (which shows up in landscape mode visually on the designer), then tied the segue action to the button. I left everything defaulted.

Hitting the button on the initial view controller initiates the segue with no problems, and the new screen loads up, but ALWAYS in portrait mode.

What am I doing wrong? Is there some toggle I'm missing? I figured that if via the summary of the project, I have it locked into landscape left and right, it would assume I always want that orientation unless otherwise noted? Please help!

Upvotes: 1

Views: 3232

Answers (4)

Jason
Jason

Reputation: 168

In the properties file for your app (YOURAPPNAME-Info.plist), located in the "supporting files" group, there is an array called "Supported interface orientations". Remove both landscape values from the array and your app will be locked in portrait orientation.

Upvotes: 0

909jester
909jester

Reputation: 31

I had the same problem and managed it by adding a new own ViewControllerClass to the new scene. Within the following auto created method, you can restrict the orientation to landscape only. This is also helpful for the Main Scene ViewController:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (UIInterfaceOrientationIsLandscape(interfaceOrientation));
}

Cheers, Daniel

Upvotes: 3

geminiCoder
geminiCoder

Reputation: 2906

What have you put in the orientation delegate method?

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

Upvotes: 1

Ethan Allen
Ethan Allen

Reputation: 14835

I have an application for iPad that is locked into landscape mode.

How are you locking it app-wide? Just want to make sure you are doing it correctly.

To lock an orientation in Storyboard mode, select your ViewController and on the Attributes inspector change the Orientation from Inferred to whatever you want it to be locked to.

Upvotes: 1

Related Questions