Scott Roepnack
Scott Roepnack

Reputation: 2735

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?

Upvotes: 1

Views: 349

Answers (2)

Scott Roepnack
Scott Roepnack

Reputation: 2735

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.

Upvotes: 1

CocoaEv
CocoaEv

Reputation: 2984

modal view controllers have 4 base animation style and none of them act like the navigation controller push. So its very likely your segue is either defined incorrectly or they are being "presented" from code.

To make sure that the storyboard segue's are "push" and not modal. You can check on this in Interface Builder - go to storyboard and click on the segue connection line. In the object inspector where the segue name is identified, just below that it should say "push" and not "modal". If it says "modal", change it to "push" and the animation should correct itself.

also make sure in your code that you are using the preformSeque ... method for showing the next view controller and not doing something like presentModalViewController ....

Upvotes: 1

Related Questions