IOS tab頁跳轉

今天在做ios開發過程中遇到了一個問題,就是在tab頁跳轉。


我想要實現的是從tab1,tab2,tab3,tab4頁都要跳轉到tab3的root View。


以下是實現的相關代碼:

-(void)goToCartBtnPressed:(id)sender

{

    self.tabBarController.tabBar.hidden =NO;//因爲我需要跳轉那頁把Tab Bar 隱藏了

    [self.tabBarControllersetSelectedViewController:[self.tabBarController.viewControllersobjectAtIndex:2]];//tab選擇購物車界面

    [self.navigationControllerpopToRootViewControllerAnimated:YES];//回到根目錄

}


以上就是實現tab跳轉的相關代碼。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章