gpt4 book ai didi

iphone - shouldAutorotateToInterfaceOrientation 在通用应用程序中不起作用

转载 作者:行者123 更新时间:2023-12-03 20:32:57 26 4
gpt4 key购买 nike

我编写了一个通用应用程序,并且在“shouldAutorotateToInterfaceOrientation”方法中返回了 YES。该方法被调用,但每当我更改 Iphone 或 Ipad 的方向时, View 都不会旋转。我什至设置了 autoresizesSubviews

最佳答案

这主要是因为其他一些内部 View 不允许/设置方向更改。为了清楚起见,当您旋转设备时,将为卡在 View 树上的每个 View Controller 调用方法 shouldAutorotateToInterfaceOrientation 。如果其中任何一个返回NO,则界面不会改变。

例如,如果您有一个带有 View Controller A、B、C 和 D 的选项卡 Controller ,则将为所有 View Controller 调用该方法,无论现在是否显示。

因此请确保您已在所有 View 中更改它。

关于iphone - shouldAutorotateToInterfaceOrientation 在通用应用程序中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6544503/

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