[英]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.