[英]NavigationController doesn't rotate
I have two views, both under the NavigationController. 我有两个视图,都在NavigationController下。 I don't want View 1 (on the left) to rotate, but I do want the View 2 (on the right) to rotate.
我不希望View 1(在左侧)旋转,但我确实希望View 2(在右侧)旋转。 View 1 and View 2 are routed to different classes.
视图1和视图2被路由到不同的类。
I put this code in the View 2 class to implement the behavior and it's not working. 我将这段代码放在View 2类中以实现该行为,但它不起作用。 It works with modal views in my app, thought
我认为,它可以与我的应用中的模式视图一起使用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
I wouldn't like to make the view №1 rotatable under any circumstances. 我不想在任何情况下都可以旋转视图№1。 Any ideas how to do this?
任何想法如何做到这一点? Thanks in advance!
提前致谢!
The behavior you're wanting is unfriendly to the user and possible against HIG. 您想要的行为对用户不友好,并且可能会对HIG不利。 The reason it isn't working is because there are protections in UINavigationController against this disruptive behavior.
它不起作用的原因是因为UINavigationController中有针对这种破坏性行为的保护措施。 When you have viewControllers Nav, tab, or modal with different rules for rotation it can sometimes fail, jerk, or otherwise not work at all as you see.
当您的ViewControllers Nav,Tab或modal具有不同的旋转规则时,有时可能会失败,颠簸,或者根本无法正常工作。
Basically I'm saying don't do this. 基本上我是说不要这样做。 Not that its not possible.
并非不可能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.