如何将已开发的应用程序更改为横向和纵向两种方向?

Posted

技术标签:

【中文标题】如何将已开发的应用程序更改为横向和纵向两种方向?【英文标题】:How to change already developed app into both orientations Landscape and portrait? 【发布时间】:2011-07-06 12:04:29 【问题描述】:

我以纵向模式开发了应用程序(导航+标签栏)。

但现在我希望用户将其方向更改为横向或 肖像,那么所有人都应该在那个方向上旋转。

【问题讨论】:

【参考方案1】:

您需要设置每个视图的控件 autoresizingmask。您可以根据需要通过 xib 和代码执行此操作,并在所有视图控制器中添加以下方法,它应该可以工作。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
    // Overriden to allow any orientation.
    return YES;

希望对您有所帮助。

【讨论】:

【参考方案2】:

看看你的“.plist”,你可以在这里定义“支持的界面方向”(UISupportedInterfaceOrientations)。

【讨论】:

以上是关于如何将已开发的应用程序更改为横向和纵向两种方向?的主要内容,如果未能解决你的问题,请参考以下文章