Closed LZS-bobo closed 6 years ago
继承 RTRootNavigationController
- (void)viewDidLoad { [super viewDidLoad]; // self.useSystemBackBarButtonItem = NO; [self.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forBarMetrics:UIBarMetricsDefault]; self.navigationBar.tintColor = TITLE_TEXT_COLOR; } - (void)back { [self popViewControllerAnimated:YES]; } - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { viewController.navigationController.navigationBar.tintColor = TITLE_TEXT_COLOR; //非跟控制器 if (self.childViewControllers.count) { self.tabBarController.tabBar.hidden = YES; //隐藏底部导航条 viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"nav_back"] style:UIBarButtonItemStyleDone target:self action:@selector(back)]; viewController.rt_disableInteractivePop = NO; viewController.hidesBottomBarWhenPushed = YES; } [super pushViewController:viewController animated:animated]; }
改文字颜色?还是图片颜色?
文字和图片都没有效果
首先,你这个需求感觉完全没必要继承重写;然后改标题文字颜色用 titleAttributes,
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: xxx};
改图片颜色,图片要改为 Template,而不是 Default。
继承 RTRootNavigationController