——.當(dāng)UITabBarController 與UINavigationController 界面搭建時(shí),從導(dǎo)航控制器的根視圖跳轉(zhuǎn)到 另一個(gè)視圖時(shí) 隱藏 tabbar的問(wèn)題
1.根視圖從代碼
/**當(dāng)視圖即將出現(xiàn)時(shí) 執(zhí)行的代碼*/
-(void)viewWillAppear:(BOOL)animated
{
//判斷view的個(gè)數(shù) 當(dāng)為1時(shí) tabbar顯示 责鳍,否側(cè)隱藏
if (self.navigationController.viewControllers.count > 1) {
self.tabBarController.tabBar.hidden = YES;
self.hidesBottomBarWhenPushed = YES;
}else {
self.tabBarController.tabBar.hidden = NO;
self.hidesBottomBarWhenPushed = NO;
}
}
/**點(diǎn)擊cell時(shí)跳轉(zhuǎn)*/
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// 獲取任務(wù)詳情界面
UIViewController *dataview=[self.storyboard instantiateViewControllerWithIdentifier:@"XQ"];
dataview.navigationItem.title=@"任務(wù)詳情";
BaseTask *task=self.arrMut[indexPath.row];
[ dataview setValue: task forKey:@"task" ];
//隱藏tabar
[dataview? setHidesBottomBarWhenPushed:YES];
// 跳轉(zhuǎn)到任務(wù)詳情界面
[self.navigationController pushViewController:dataview animated:YES];
}
說(shuō)明 要使隱藏起作用 ,需要先隱藏 tabbar 然后再跳轉(zhuǎn)界面 否者不起作用