tabbar隱藏問題

——.當(dāng)UITabBarController 與UINavigationController 界面搭建時(shí),從導(dǎo)航控制器的根視圖跳轉(zhuǎn)到 另一個(gè)視圖時(shí) 隱藏 tabbar的問題

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];

}

說明 要使隱藏起作用 ,需要先隱藏 tabbar 然后再跳轉(zhuǎn)界面 否者不起作用

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容