简体   繁体   English

UINavigationController,错误的背面 animation 方向

[英]UINavigationController, wrong back animation orientation

I have a really weird problem, driving me crazy!我有一个非常奇怪的问题,让我发疯!

My app has only one orientation: portrait.我的应用只有一个方向:纵向。 By pushing a button you can open a UINavigationController modally (by calling the method presentModalViewController ...).通过按下按钮,您可以模态地打开UINavigationController (通过调用方法presentModalViewController ...)。 This UINavigationController can be orientated ( shouldAutorotate always returns YES ).这个UINavigationController可以定向( shouldAutorotate总是返回YES )。

That works fine except for one thing: The transition.除了一件事之外,这很好用:过渡。 it is always in portrait.它总是纵向的。 I don't understand why.我不明白为什么。 I tried to set the status bar's orientation to match the UINavigationController's orientation but it didn't work.我试图设置状态栏的方向以匹配UINavigationController's方向,但它没有工作。 I m very puzzled...我很纳闷...

Can anybody help me?有谁能够帮我?

thanks!谢谢!

Use this code on.m of that view controller where you r presenting modal在该视图的 controller 的.m 上使用此代码,您在其中 r 呈现模态

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{

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

    return YES;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UINavigationController + UITableViewController 在横向方向的返回转换错误 - Back Transition Wrong in UINavigationController + UITableViewController in Landscape Orientation UINavigationController方向 - UINavigationController Orientation 使用UINavigationController iOS 6弹回到初始viewcontroller时,方向会发生变化 - Orientation changes when pop back to the initial viewcontroller using UINavigationController iOS 6 UINavigationController动画 - UINavigationController animation RootViewController动画过渡,初始方向错误 - RootViewController animation transition, initial orientation is wrong UINavigationController中的ViewController方向更改 - ViewController in UINavigationController orientation change 使用UITabbar的UINavigationController中的方向锁定 - Orientation lock in UINavigationController with UITabbar UIImageView在动画过程中以错误的方向显示相机拍摄的图像 - UIImageView shows images taken by camera in wrong orientation during animation UISearchController 错误的滑动​​动画然后消失 - UISearchController wrong animation on swipe back then disappearing UINavigationController工具栏和设备方向(旋转) - UINavigationController Toolbar and device orientation (rotation)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM