Search code examples
ios5uinavigationcontrollerpopviewcontrolleranimated

UINavigatorController popViewController:animated shows strange behaviour in iOS 5.1 but not in iOS 6


I found out some strange behaviour that I can't explain in my iOS App.

I'm using a standard UINavigationController that is embedded in a UITabBarController Subclass.

When I push a ViewController on the NavigationController the animation is just fine. But when a ViewController is popped in Landscape the pop animation happens from the top of the screen to the lower end in contrast to the right to left standard behaviour that is expected.

Even more strange that the TabBar is included in the animated transition, which is also not the case in Portrait mode.

This happens only on iOS 5 devices, and at the moment I just don't have a clue why this happens.


Solution

  • We found the solution. The problem was the first view controller implementing shouldAutorotateToInterfaceOrientation with only allowing rotation for UIInterfaceOrientationPortrait - this wasn't obvious as it actually rotated correctly to any (globally allowed) orientation.

    So, this property was only having an effect on the push and pop behavior. Now both view controllers (the first and the one that is being pushed) implement shouldAutorotateToInterfaceOrientation with return YES;. Now the animation is correct (from left to right and vice versa in landscape mode, instead of right to left when pushed and top to bottom when popped).