问题
I am using storyboard and have my app set to be only horizontal left and right. I have a view controller where I click to go to my next view and do whatever, and when I am done I click the back button. What happens is when I click the back button the horizontal view switches to portrait and messes my whole app up. I have my segues set as push, but I did have them at modal.

Then it goes to my next screen

When I click back, it for some reason switches to portrait and looks like this:

I have no idea why it would do this... Has anybody else had this problem or have an idea of whats going on???
回答1:
You need to go through and set your rootViewController's orientation to landscape only. Then make sure all other viewControllers orientations are set to inferred.
It is also a good idea if you haven't already to go into your info.plist and make sure you have supported only landscape orientations.
Also you may need to add some code to your viewControllers that looks something like this:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
来源:https://stackoverflow.com/questions/11798808/when-i-click-the-back-button-my-view-changes-from-landscape-to-portrait