导航控制器,错误的返回动画方向。

4

我有一个非常奇怪的问题,让我疯狂!

我的应用程序只有一个方向:竖屏。通过按下一个按钮,您可以通过调用方法presentModalViewController以模态方式打开UINavigationController。这个UINavigationController可以被定位(shouldAutorotate始终返回YES)。

除了一个问题外,这很好运作!过渡效果:它总是处于竖屏状态。我不明白为什么会这样。我试图将状态栏的方向设置为与UINavigationController的方向匹配,但没有成功。我非常困惑......

谁能帮帮我?

谢谢!

1个回答

0
请在您呈现模态的那个视图控制器的 .m 文件中使用此代码。
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{

    if((toInterfaceOrientation == UIInterfaceOrientationPortrait) ||(toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown))
        return NO;

    return YES;
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接