shouldAutorotateToInterfaceOrientation不工作

时间:2012-11-14 07:56:27

标签: iphone orientation

  

可能重复:
  Problem pushViewController from Landscape to Portrait

在我的应用程序中,某些视图控制器支持横向和纵向,而有些仅支持纵向。

我有3个视图控制器 FirstVC SecondVC ThirdVC 。我想要:

  • FirstVC ThirdVC 支持横向和人像
  • SecondVC 应仅支持肖像。

为此我:

  • 在所有View Controller
  • 中覆盖shouldAutorotateToInterfaceOrientation
  • SecondVC
  • 中返回UIInterfaceOrientationIsPortrait(interfaceOrientation);
  • 在其他两个中返回YES。

当我从 FirstVC 推送 SecondVC 时(在横向模式下),我的SecondView不会转换为纵向,它仍保持横向状态。但是当我将SecondVC旋转为肖像时,它会在我旋转时相应地再次旋转,这次它保留在纵向中不会改变为横向。

我希望我很清楚。

任何人都可以知道我做错了吗?提前谢谢!

1 个答案:

答案 0 :(得分:0)

看一下这篇文章Problem pushViewController from Landscape to Portrait

你必须以模态方式呈现VC。