diff --git a/RTRootNavigationController/Classes/RTRootNavigationController.m b/RTRootNavigationController/Classes/RTRootNavigationController.m index 875c6c8..5366b02 100644 --- a/RTRootNavigationController/Classes/RTRootNavigationController.m +++ b/RTRootNavigationController/Classes/RTRootNavigationController.m @@ -187,7 +187,6 @@ - (instancetype)initWithController:(UIViewController *)controller self.containerNavigationController.viewControllers = @[controller]; [self addChildViewController:self.containerNavigationController]; - [self.containerNavigationController didMoveToParentViewController:self]; } return self; } @@ -222,7 +221,6 @@ - (instancetype)initWithContentController:(UIViewController *)controller if (self) { self.contentViewController = controller; [self addChildViewController:self.contentViewController]; - [self.contentViewController didMoveToParentViewController:self]; } return self; } @@ -332,6 +330,20 @@ - (UITabBarItem *)tabBarItem return self.contentViewController.tabBarItem; } +-(void)willMoveToParentViewController:(UIViewController *)parent +{ + [super willMoveToParentViewController:parent]; + if (parent) return; + [self.contentViewController willMoveToParentViewController:parent]; +} + +-(void)didMoveToParentViewController:(UIViewController *)parent +{ + [super didMoveToParentViewController:parent]; + if (parent) return; + [self.contentViewController didMoveToParentViewController:parent]; +} + @end @interface UIViewController (RTContainerNavigationController)