简体   繁体   English

NavigationController不旋转

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

相关问题 NavigationController中的NavigationBar没有显示在IB StoryBoard中 - NavigationBar from NavigationController doesn't show in IB StoryBoard UIWebView不会与多个选项卡应用程序一起旋转 - UIWebView doesn't rotate with multiple tabs application presentModalViewController在iPhone / iPad中无法正确旋转 - presentModalViewController doesn't rotate properly in iPhone / iPad iPhone:MPMoviePlayerController在iOS 5.0上不旋转 - iPhone: MPMoviePlayerController doesn't rotate on iOS 5.0 MPMoviePlayerViewController不会自动旋转 - MPMoviePlayerViewController doesn't auto-rotate 当添加为NavigationController视图的子视图时,iOS视图不会显示其任何子视图 - iOS view doesn't display any of it's subviews when added as a subview of NavigationController's view XCode5 self.navigationController pushViewController:animated:不会打开新的viewcontroller - XCode5 self.navigationController pushViewController:animated: doesn't open the new viewcontroller NavigationController的backButton不出现 - backButton of NavigationController don't appear Navigationcontroller-为什么不起作用? - Navigationcontroller - why isn't this working? 旋转视图不会旋转音量按钮图标 - Rotated view doesn't rotate the volume button icon
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM