gpt4 book ai didi

ios - shouldAutorotateToInterfaceOrientation 返回 YES

转载 作者:行者123 更新时间:2023-11-28 22:46:16 32 4
gpt4 key购买 nike

我经常看到这样的代码:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return YES;
}

如果在项目配置中设置了支持的方向,那么一直返回YES岂不是毫无意义?或者在某些情况下这会产生影响?

最佳答案

shouldAutorotateToInterfaceOrientation:(顺便说一句,自 iOS 6 起已弃用)与信息 plist 中的 UISupportedInterfaceOrientations 完全不同!如果您不实现此方法,则无论您在 UISupportedInterfaceOrientations 中指定什么,相应的 View Controller 都不会自动旋转到该界面方向。

来自documentation of UISupportedInterfaceOrientations :

The system uses this information (along with the current device orientation) to choose the initial orientation in which to launch your app.

关于ios - shouldAutorotateToInterfaceOrientation 返回 YES,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13141849/

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