简体   繁体   中英

NavigationController doesn't rotate

I have two views, both under the 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 and View 2 are routed to different classes. 在此处输入图片说明

I put this code in the View 2 class to implement the behavior and it's not working. 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. Any ideas how to do this? Thanks in advance!

The behavior you're wanting is unfriendly to the user and possible against HIG. The reason it isn't working is because there are protections in UINavigationController against this disruptive behavior. 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.

Basically I'm saying don't do this. Not that its not possible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM