gpt4 book ai didi

ios - supportedInterfaceOrientations 设置是否在模拟器中正常工作?

转载 作者:行者123 更新时间:2023-11-29 01:12:27 25 4
gpt4 key购买 nike

我有一个项目,其中所有 View 都只能是纵向 View ,除了一个只有横向 View 且不能自动旋转的 View 。我在项目设置中将支持的方向设置为纵向和横向。然后我为每个 View Controller 设置这些函数:

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationLandscapeLeft; // or Right of course
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}

-(BOOL)shouldAutorotate
{
return NO;
}

但它不起作用。模拟器允许所有 View 旋转并且似乎完全忽略了这些设置。我做错了什么,还是模拟器中的错误?

最佳答案

问题很可能是您在 info.plist 中定义了允许的方向,它覆盖了代码中指定的任何内容。

因此您可能需要从 info.plist 中删除条目。

关于ios - supportedInterfaceOrientations 设置是否在模拟器中正常工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35582586/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com