Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当执行逻辑:从三级页面popToRoot,切换tab页,push页面后,返回tab页时tabbar消失 #241

Closed
1992zhangbo opened this issue Jan 24, 2018 · 2 comments

Comments

@1992zhangbo
Copy link

  1. Version:v1.16.0
  2. Language:Objective-C
  3. iOS System Version:iOS9
  4. Prototype(是否是真机):YES
  5. Issue Type:Bug

1. How to repeat the problem.

页面路径如下:
CYLMineViewController -> xxxList -> xxxDetail

xxxDetail有一个按钮,点击执行如下逻辑:
//返回CYLMineViewController
[self.navigationController popToRootViewControllerAnimated:NO];
//跳转到某个tab页
AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate];
app.tabBarController.selectedIndex = 1;
//push进去一个页面
[(UINavigationController *)app.tabBarController.selectedViewController pushViewController:[xxxList new] animated:YES];

出现问题:
点击返回时,tabbar会消失。试了一下系统的tabbar,也会消失

2. Please help me in this way.

希望大神提供个解决方案,不胜感谢

3. Here is a Demo.

逻辑很简单,源码已经贴出

4. Here is my Debug log

@hongdong
Copy link

hongdong commented Apr 12, 2018

这个问题解决了吗? @ChenYilong

@ChenYilong
Copy link
Owner

ChenYilong commented Jul 1, 2018

这个是v1.17.13 版本更新后的实现:

ref:5ab213b

//UIViewController+CYLTabBarControllerExtention
- (UIViewController *)cyl_popSelectTabBarChildViewControllerAtIndex:(NSUInteger)index {
   UIViewController *viewController = [self cyl_getViewControllerInsteadOfNavigationController];
   [viewController checkTabBarChildControllerValidityAtIndex:index];
   CYLTabBarController *tabBarController = [viewController cyl_tabBarController];
   tabBarController.selectedIndex = index;
   [viewController.navigationController popToRootViewControllerAnimated:NO];
   UIViewController *selectedTabBarChildViewController = tabBarController.selectedViewController;
   return [selectedTabBarChildViewController cyl_getViewControllerInsteadOfNavigationController];
}

只需要把这两行代码的顺序调整一下就行了,像下边这样

tabBarController.selectedIndex = index;
[navigationController popToRootViewControllerAnimated:NO];

原则上,上面两行的调用顺序对效果无影响,疑似是系统bug,Xcode9 系统修改了pop的调用时机。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants