在横向模式下打开视图 [英] Opening a view in Landscape mode

查看:107
本文介绍了在横向模式下打开视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发纵向模式的应用程序.在我的一个视图控制器中,当我单击表格视图时,另一个视图以纵向模式打开.我希望它以横向模式打开. 请建议我该怎么做. 在此先感谢!

I am developing an application in portrait mode.In my one view controller when I click on table view another view opened in portrait mode.I want it to be opened in landscape mode. Please suggest me how to do this. Thanks in advance!!

推荐答案

据我所知,实现此目的的唯一方法是将视图控制器显示为模态,

As far as I know, the only way to achieve this is to to show the view controller as a modal with

[self presentModalViewController:landscapeViewController animated:YES];

并在其中指定横向模式

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

这是因为如果模式视图只能在一个方向上显示,则应用程序会自动旋转到该方向.

This is because if a modal view can appear in only one orientation, the app automatically rotates to that orientation.

有关此问题的更多详细信息,请参见接受的答案:过渡到景观旋转在uinavigationcontroller中

See the accepted answer for this question for more details: Transitioning to landscape rotation within a uinavigationcontroller

这篇关于在横向模式下打开视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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