Search code examples
iosuinavigationcontrollersegueuistoryboardsegue

iOS storyboarding UINavigationController pops view improperly (slides down, instead of to the right)


I working on storyboarding an iOS app. I'm at the stage where I am making sure landscape orientation works properly throughout the app. I have one issues left and that is: if the phone is landscape mode and I pop a view controller from the stack, via the back button, the animation pops by slidings the view down rather than the general method of to the right.

Here's the app structure:

1 UITabBarController
   2 UINavigationController
      3 UITableViewController
   2 UINavigationController
      3 UIViewController

On the first table (the one with the UITableViewController) the back animation works as expected (move to the right), but on the second tab, the animation is not working properly. All the pushes and pops are handled through storyboarding, not code.

Any ideas?


Solution

  • My mistake!

    I forgot to update the shouldAutorotateToInterfaceOrientation method in all of the view controllers. Here's the original:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    

    Here's what it should be to allow rotation to all orientations:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        return YES;
    }
    


    The complication was the view was rotating to landscape already because the super view did have the rotation code updated properly, but the subview did not.