发布于 2016-01-02 13:25:22
请检查Info.plist的“支持的接口方向”。它必须显示肖像以满足你的要求。有时,在常规选项卡中,它不会被更新为项目设置。如果你在这里发现景观方向,然后移除它。
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>

发布于 2016-01-02 16:55:02
iOS9中存在某种bug。它完全忽略了plist文件方向设置。因此,我必须将这段代码添加到我的每个UIViewControllers中,以获得肖像画方向。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
if (interfaceOrientation == UIInterfaceOrientationPortrait)
{
return YES;
}
else
{
return NO;
}
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- (NSUInteger)supportedInterfaceOrientations
#else
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
#endif
{
return UIInterfaceOrientationMaskPortrait;
}发布于 2016-01-04 04:23:36
看来我发现了问题。当我查看我的info.plist的来源时,我发现:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>不知道UISupportedInterfaceOrientations~ipad密钥是如何产生的。当作为属性列表查看时,最初不会显示它,但是在作为源代码打开并保存后,它将开始显示在属性列表中。
此外,现在似乎有办法在常规选项卡中设置此选项卡。感谢SamB和technerd让我走上了正确的道路。
PS:我不确定这是一个bug还是预期的行为,所以我欢迎任何关于这方面的见解。
https://stackoverflow.com/questions/34566240
复制相似问题