强制 UIViewController 仅以横向模式显示 [英] Force UIViewController to only show in landscape mode

查看:18
本文介绍了强制 UIViewController 仅以横向模式显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

My app runs in portrait mode, but i want to show one screen in landscape mode only as it is a chart. What do i add to my uiviewcontroller to force it into landscape mode only?

推荐答案

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

I'm sorry but this answer will be very short: If you're using the UINavigationController, you can't. The answer @jer gives is therefore incorrect. The Apple documentation states:

您的 UITabBarController 或 UINavigationController 中的所有子视图控制器都没有就共同的方向集达成一致.

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

我最近在赏金中回答了这个问题,但我的应用程序在此过程中被拒绝了.请在此处阅读:如何将某些视图的自动旋转限制为单一方向,同时允许其他视图的所有方向?

I recently had this question answered on a bounty and my app rejected in the process. Read up on that here: How to constrain autorotation to a single orientation for some views, while allowing all orientations on others?

你唯一的解决方案是扔掉 UINavigationController 并用你自己的东西重写它.

The only solution you have, is to throw away the UINavigationController and rewrite it with something of your own.

这篇关于强制 UIViewController 仅以横向模式显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆