tabbarVC 上子VC首页 跳转到 子VC用户中心,跳转成功。但是点击首页,仍然保持跳转前的页面状态,如何让首页初始化呢?

tabbar 是根视图

 场景:从targetVC跳转用户中心,场景介绍完成。
 需求:点击"首页",出现的是targetVC,需求是点击首页需要回到MainVC
 问题:这个如何实现?
    //获取tabbar控制器
    UITabBarController *tabbarVC = (UITabBarController *)[UIApplication sharedApplication].keyWindow.rootViewController;
    tabbarVC.selectedIndex = 1;

demo

阅读 2.9k
3 个回答

[self.navigationController popToRootViewControllerAnimated:YES];
tabbar.selectedIndex = 1;

看的我都晕了。。。你就说tab中放的vc有哪些,层级一层一层的说,然后说操作,哪步有问题

[tabCon setSelectedIndex:1];
[self.navigationController popViewControllerAnimated:YES];

推荐问题