今天在做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跳转的相关代码。