xCode6 incorrect view controller orientation when

2019-08-08 20:07发布

问题:

I'm running into a weird issue when testing an app with deployment target of 7.1 compiled with xCode6 and tested on an iOS 7.1.2 and iOS 8.0.2 devices.

A view controller is defined in storyboard with a portrait placeholder. The app supports landscape orientation only.

in app delegate:

@property (nonatomic,strong) UIViewController* privacyScreen;
self.privacyScreen = [kMainStoryboard instantiateViewControllerWithIdentifier:@"privacyScreen"];
[self.window addSubview:self.privacyScreen.view];

When deployed to iOS8, the status bar is in landscape and the view controller is in landscape. When deployed to iOS 7.1, the status bar is in landscape, but the view controller is in portrait

How can I make sure my view controllers are in the expected orientation, regardless of which iOS they run on? For example, I would expect to have no portrait view controllers if my app does not support portrait in the project settings.