Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird animation when popping an UIViewController from an UINavigationController (IOS 5)

I'm implementing a container view controller where a part of the screen is a view containing an UINavigationController view. My viewDidLoad: is something like this:

// ...
UIViewController *myNavigationController = [self.storyboard instantiateViewControllerWithIdentifier:@"MyNavigationController"];
[self addChildViewController:myNavigationController];
[self.myContainerView addSubview:myNavigationController.view];
[myNavigationController didMoveToParentViewController:self];
// ...

No problems with rotations, and pushing new view controllers into the navigation controller works fine. But when the user taps on the Back UIBarButtonItem, not just self.myContainerView but the whole self.view animates upwards, similar to kCATransitionFromBottom, instead of the normal navigation controller pop animation. After a few more debugging I realized that my view controller's viewWillDisappear: and viewWillAppear: methods are getting called when popping from myNavigationController.

Unfortunately, I'm stuck. I'll appreciate if anyone can give an idea what's going and how to work around this.

Edit: OK nevermind. I forgot to implement shouldAutorotateToInterfaceOrientation: in one of my navigation controller's children. returning YES fixed the problem.

like image 638
John Estropia Avatar asked Dec 11 '11 12:12

John Estropia


1 Answers

OK nevermind. I forgot to implement shouldAutorotateToInterfaceOrientation: in one of my navigation controller's children. returning YES fixed the problem.

like image 149
John Estropia Avatar answered Nov 15 '22 22:11

John Estropia