2016-12-16 09:13:19.318 TheStep[1159:150589] ***
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason:
'Pushing a navigation controller is not supported'
之前
@interface DiscoverViewController : UIViewController
我讓他繼承
正解:
UIViewController * viewController = [[NSClassFromString(objDictionary[kClass]) alloc ] init ];
BaseItemNaviViewController * navigationViewController = [[BaseItemNaviViewController alloc ]
在 MainTabBarController 里面改
就不用一個一個這樣了
- (void)tapSearchBar
{
SearchMessgViewController * searchMessgViewController = [[SearchMessgViewController alloc ] init ];
// searchMessgViewController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController: searchMessgViewController animated: YES ];
}
感謝簡書
iOS+TabBar的隱藏钻洒,hidesBottomBarWhenPushed的正確使用
NavigationController重寫push方法(學習小碼哥的方法)
感謝
iOS:hidesBottomBarWhenPushed的正確用法
Case1:xib加載或者Storyboard用identifier獲取Controller
UIViewController *v2 = [self.storyboard instantiateViewControllerWithIdentifier:@"v2"];
v2.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:v2 animated:YES];
Case2:拉線忧设,也就是Storyboard用performSegue
self.hidesBottomBarWhenPushed = YES;
[self performSegueWithIdentifier:@"tov2" sender:nil];
self.hidesBottomBarWhenPushed = NO;
Tip:經(jīng)測試證明,此種方式只會對后面的一級生效博助,繼續(xù)往后Push還會出現(xiàn)TabBar,要繼續(xù)往后push也隱藏Tabbar還得使用Case3的方法痹愚,也建議如此富岳!
Case3:拉線,在prepareForSegue函數(shù)里
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
[segue.destinationViewController setHidesBottomBarWhenPushed:YES];
}
更方便的做法:如果你在用 Storyboard拯腮,可以在 ViewController 的設(shè)置面板中把 Hide Bottom Bar on Push 屬性勾選上窖式,效果和上文代碼一樣。