简体   繁体   中英

Orientation iOS storyboard don't rotate?

OKay, this is probably pretty noob, but I couldn't find how to solve it. I dragged an iPad UIViewController to the storyboard and enabled the orientation to YES. But for some reason that view is not rotating. The status bar at the top is rotating but the view, tableview and labels inside are not rotating when you rotate the iPad. Anyone know why and how to fix it?

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOr‌​ientation { return YES; } 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        //return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
        if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
           //implement your code 
        return (interfaceOrientation != UIInterfaceOrientationLandscapeRight);
    } else {

        return YES;
    }
}

I think it will be helpful to you.

The status bar rotating might mean that some modal segue was not dismissed properly just check. Also if its in a navigation controller make sure all views in the stack has been set to return YES.

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