如何强制特定视图控制器中的屏幕方向? [英] How to force a screen orientation in specific view controllers?

查看:81
本文介绍了如何强制特定视图控制器中的屏幕方向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序很简单:它启动与视图控制器,它保存一个表视图(在分组视图布局)与几个选项。当用户点击其中一个选项时,我将另一个视图控制器推到我的导航控制器上。

My application is pretty simple: it starts up with a view controller that holds a table view (in grouped view layout) with a few options. When the user taps on one of the options, I push another view controller onto my navigation controller.

第二个视图控制器只显示一个UIImageView,用户可以更改纵向/横向模式之间的视图控制器上的屏幕方向。

This second view controller simply displays a UIImageView, and the user can change the screen orientation on this view controller between portrait/landscape modes. This works just fine, and all is happy.

但是,如果用户在横向模式下点击导航栏上的后退按钮,第一个控制器布局都乱了。请参阅下面的截图之前/之后:

However, if the user taps on the "Back" button on my navigation bar while on the landscape mode, the first controller's layout is all messed up. See below for before/after screenshots:


有关如何强制第一个视图控制器的任何线索

Any clues on how to force the first view controller (second screenshot in this post) to stay within the portrait screen orientation?

推荐答案

似乎没有办法做到这一点文档化的方法。

There does not appear to be a way to do this using the documented methods.

我提交了此错误:rdar:// 6399924

I have filed a bug for this: rdar://6399924

没有办法将UIViewController限制为一个方向

"There is no way to always restrict a UIViewController to one orientation"

您可以在开放雷达中看到它(以及重现问题的示例代码的链接): http://openradar.appspot.com/radar?id=697

You can see it on open radar (along with a link to sample code to reproduce the problem) here: http://openradar.appspot.com/radar?id=697

这篇关于如何强制特定视图控制器中的屏幕方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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