iphone - 强制 UIViewController 仅在横向模式下显示

标签 iphone objective-c uiviewcontroller orientation

我的应用程序以纵向模式运行,但我只想在横向模式下显示一个屏幕,因为它是一张图表。我应该向我的 uiviewcontroller 添加什么以强制它仅进入横向模式?

最佳答案

很抱歉,这个答案会很简短:如果您使用的是 UINavigationController,则不能。因此@jer 给出的答案是不正确的。 Apple 文档指出:

All child view controllers in your UITabBarController or UINavigationController do not agree on a common orientation set.

我最近在悬赏中回答了这个问题,但我的应用程序在此过程中被拒绝了。在这里阅读:How to constrain autorotation to a single orientation for some views, while allowing all orientations on others?

你唯一的解决办法是扔掉 UINavigationController 并用你自己的东西重写它。

关于iphone - 强制 UIViewController 仅在横向模式下显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5339662/

相关文章:

ios - 如何根据其中的 UILabel 使 UIView 自动高度?

iphone - 在选定的选项卡栏项目上点击两次隐藏当前 View Controller

ios - 不能用 `UIPageViewController` 刷 `UINavigationController`

iphone - 同一数据的不同 View 之间转换的概念

iphone - CoreData NSFetchedResultsController 空部分显示

iphone - 在 iPhone 游戏中使用矢量图形

网络服务

objective-c - 在 map 上绘制时减少多边形

ios - 如何在 View Controller 之间传递变量引用?

iphone - 设置 UISegmentedControl 的背景图片