鍍金池/ 問答/iOS/ tabbarVC 上子VC首頁 跳轉(zhuǎn)到 子VC用戶中心,跳轉(zhuǎn)成功。但是點(diǎn)擊首頁

tabbarVC 上子VC首頁 跳轉(zhuǎn)到 子VC用戶中心,跳轉(zhuǎn)成功。但是點(diǎn)擊首頁,仍然保持跳轉(zhuǎn)前的頁面狀態(tài),如何讓首頁初始化呢?

tabbar 是根視圖

 場景:從targetVC跳轉(zhuǎn)用戶中心,場景介紹完成。
 需求:點(diǎn)擊"首頁",出現(xiàn)的是targetVC,需求是點(diǎn)擊首頁需要回到MainVC
 問題:這個(gè)如何實(shí)現(xiàn)?
    //獲取tabbar控制器
    UITabBarController *tabbarVC = (UITabBarController *)[UIApplication sharedApplication].keyWindow.rootViewController;
    tabbarVC.selectedIndex = 1;

demo

回答
編輯回答
墨染殤

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

2017年10月24日 15:08
編輯回答
憶當(dāng)年

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

2017年2月6日 22:12
編輯回答
陌璃

看的我都暈了。。。你就說tab中放的vc有哪些,層級(jí)一層一層的說,然后說操作,哪步有問題

2017年7月7日 06:34