我的nav本來設置的紅色悼沈,但是被前面這個遮住了
DJMYViewController * business = [[DJMYViewController alloc] init];
business.title = @"我";
UINavigationController * nav3 = [[UINavigationController alloc] initWithRootViewController:business];
[self setViewControllers:@[nav1,nav2,nav3]];
這是在我的UITabBarController里面寫的3個nav對應的代碼
改動后:
代碼如下:
DJConferenceViewController * staffVC = [[DJConferenceViewController alloc] init];
UINavigationController * nav1 = [[UINavigationController alloc] initWithRootViewController:staffVC];
nav1.tabBarItem.title = @"大會";
[nav1.tabBarItem setImage:[[UIImage imageNamed:@"tab_title_Dahui30-1"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[nav1.tabBarItem setSelectedImage:[[UIImage imageNamed:@"tab_title_dahui30"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
nav1.navigationBar.barTintColor = [UIColor redColor];
nav1.hidesBottomBarWhenPushed = YES;
在每個nav管理的對應的那個UIViewController里面去做nav的title按鈕等設置:
代碼如下:
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0, 200, 44)];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.font = [UIFont boldSystemFontOfSize:flexibleWidth(18.0f)];
titleLabel.textColor = [UIColor whiteColor];
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.text = @"大會";
self.navigationItem.titleView = titleLabel;