Skip to content

Commit

Permalink
fix iOS14 popToRootViewControllerAnimated 首页还有返回按钮 (#297)
Browse files Browse the repository at this point in the history
Co-authored-by: sangshuai <[email protected]>
  • Loading branch information
sunsang and sangshuai authored Aug 13, 2024
1 parent 6acef9a commit 2ab3cf2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion RTRootNavigationController/Classes/RTRootNavigationController.m
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,9 @@ - (void)navigationController:(UINavigationController *)navigationController
else if (!viewController.rt_hasSetInteractivePop) {
viewController.rt_disableInteractivePop = NO;
}
[self _installsLeftBarButtonItemIfNeededForViewController:viewController];
// fix #292 https://github.com/rickytan/RTRootNavigationController/issues/292
// 延迟到didShow里执行
// [self _installsLeftBarButtonItemIfNeededForViewController:viewController];
}

if ([self.rt_delegate respondsToSelector:@selector(navigationController:willShowViewController:animated:)]) {
Expand All @@ -949,6 +951,12 @@ - (void)navigationController:(UINavigationController *)navigationController
{
BOOL isRootVC = viewController == navigationController.viewControllers.firstObject;
viewController = RTSafeUnwrapViewController(viewController);

// fix #292 https://github.com/rickytan/RTRootNavigationController/issues/292
if (!isRootVC && viewController.isViewLoaded) {
[self _installsLeftBarButtonItemIfNeededForViewController:viewController];
}

// fix #258 https://github.com/rickytan/RTRootNavigationController/issues/258
// animated 为 NO 时的时序不太对,手动触发 viewDidLoad
if (!animated) {
Expand Down

0 comments on commit 2ab3cf2

Please sign in to comment.