更改 UITabBar 中的方向

发布于 2024-11-15 02:02:41 字数 258 浏览 4 评论 0原文

我有一个带有很多视图控制器和导航控制器的 UITabBar。我正在尝试支持两个方向,但仅限纵向工作。我知道我必须在所有视图控制器中重写此方法并返回 YES,我确实这样做了:

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

但它仍然不起作用。可能出了什么问题?

I have a UITabBar with a lot of view controllers and navigation controller. I am trying to support both orientations but only portrait works. I know that I have to override this method in all view controllers and return YES and I did like this:

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

but it still doesn't work. What could possibly be wrong?

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

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

发布评论

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

评论(1

人心善变 2024-11-22 02:02:41

确保:

  • 您的 info.plist 支持所有
    方向。
  • 所有视图
    控制器也支持它。
  • 您的 UITabBarController 本身支持它们。

Be sure:

  • Your info.plist supports all the
    orientations.
  • All the view
    controllers support it as well.
  • Your UITabBarController itselfs supports them.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文