ios - 如何将 iOS 10 通用应用程序中的单个 UIViewController 限制为纵向布局?

标签 ios iphone ipad

我有一个 iOS 10 通用应用程序(同时支持 iPad 和 iPhone)。在应用程序 .plist 中,我指定该应用程序支持纵向和横向模式。现在我想将单个 UIViewController 限制为仅纵向模式。该 View Controller 由呈现其他 View Controller 的同一导航 Controller 呈现。在 iOS 10 中将单个特定 View Controller 限制为纵向的最佳(最简单)方法是什么。(请注意,有很多已发布的解决方案,但据我所知,这个问题的答案对于不同的版本是不同的iOS。我只需要一个支持 iOS 10 的解决方案。)

最佳答案

Now I would like to restrict a single UIViewController to portrait only mode. That view controller is presented by the same navigation controller that presents other view controllers

在 iOS 10 中,没有支持的方式来执行您所描述的操作。导航 Controller 不能使其某些子项处于一个方向而其他子项处于另一个方向。

让 View Controller 强制不同方向的唯一受支持方法是使其成为呈现 View Controller (模态),不是导航中的推送 View Controller Controller 堆栈。

关于ios - 如何将 iOS 10 通用应用程序中的单个 UIViewController 限制为纵向布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40960637/

相关文章:

iOS:在后台与核心数据自动同步

iphone - 在不使用 XIB 本地化的情况下本地化我的 iPhone 应用程序?

iphone - objective-c 中的componentsSeparatedByString是什么意思?

iphone - xcode iphone 项目和 ipad 项目到通用应用程序

iphone - iPhone两次之间的时差

ios - 使用 Parse 的基于位置的推送通知

iphone - 使用 loadNibNamed 加载 UITableViewCell 时保留计数

ios - Swift iOS - 当应用程序从后台返回时,AVPlayer 视频卡住/暂停

iphone - 处理 iphone 5 & 4/4S/3G 屏幕分辨率的最佳方法是什么

iphone - 有没有办法将 iPhone 和 iPad 应用程序(在应用程序商店中作为单独的应用程序提供)合并为 1 个通用应用程序