gpt4 book ai didi

ios - 仅允许纵向 - 适用于 iOS6 但不适用于 iOS5

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

我正在使用 iOS 6.0 的 Base SDK 构建一个项目。

在 Targets > Summary 中,我将 Supported Device orientations 设置为仅纵向(未选择其他方向)。

当我在 6.0 模拟器中运行该应用程序时效果很好,该应用程序按预期锁定为纵向。但是,当我运行 5.1 模拟器时,它同时支持横向(但不支持上下颠倒)!?

我想在整个应用程序的每个 View 中强制纵向显示(禁止一个 View Controller )。目前在 iOS 5.1 中测试时,无论我做什么,它都允许旋转。

尽管在 iOS6 中被贬值了,但我保留了:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

但这并没有做任何事情。

我怎样才能在 iOS 5.0 中也只强制纵向?

最佳答案

shouldAutorotateToInterfaceOrientation 应该可以解决问题。你确定它正在执行吗?您确定它是在您的主视图 Controller 中定义的,而不是在其他地方吗?

关于ios - 仅允许纵向 - 适用于 iOS6 但不适用于 iOS5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13011880/

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