Xcode 强制启用应用程序轮换

发布于 2024-12-14 03:08:47 字数 577 浏览 0 评论 0原文

我正在开发一个基于 iPad/iPhone 标签栏的应用程序。我有大约 30 个类文件,需要在应用程序中启用旋转,以便 iPad 用户可以在任何方向查看。据我所知,每个类都需要使用以下命令来启用旋转:

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return YES;
}

但是,我在单个类文件中创建并完全显示了一些 UIViewControllers ,据我所知,您无法启用它适用于该类型。 有没有办法为应用程序启用全局轮换?我在Info.plist中尝试过。是否可以将某些内容添加到 AppDelegate 中以启用全局轮换? 顺便说一句:我已经尝试在每个类文件中添加返回 YES 进行轮换。 提前致谢, 巴哈里尼

I am working on an iPad/iPhone tab-bar based application. I have about 30 class files and need to enable rotation in the app, so that iPad users can view at any orientation. As far as I know, every class needs rotation to be enabled by using the following:

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return YES;
}

However, I have some UIViewControllers created and displayed completely in a single class file, and as far as I know you cannot enable it for that type.
Is there a way I can enable global rotation for the app? I have tried in Info.plist. is there something that can be added to the AppDelegate to enable global rotation?
Btw: I have already tried adding returning YES for rotation in every class file.
Thanks in advance,
Baharini

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

想你的星星会说话 2024-12-21 03:08:47

XcodeProject Navigator 中单击项目名称。现在,在Summary选项卡的中心视图上,您​​可以看到iPad\iPhone Development Info,这部分有Supported Device Orientations。您可以将它们全部设置为支持任何方向!

我希望它对你有用!

In Xcode on the Project Navigator click on the project name. Now on center view on the Summary tab, you can see the iPad\iPhone Development Info in this part there is Supported Device Orientations. You can set all of them for supporting any orientation!

I hope it be useful for you!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文