如果只改单个页面导航栏颜色,则在viewWillAppear: viewWillDisappear: 方法中添加如下内容
QP_Color_Background_Nav_Call 新页面的导航栏颜色
QP_Color_Background_Nav 其他页面的导航栏颜色
QP_Color_Text_Nav_title 导航栏标题颜色
- (void)viewWillAppear:(BOOL)animated{
[superviewWillAppear:animated];
self.navigationController.navigationBar.barTintColor = QP_Color_Background_Nav_Call;
self.navigationController.navigationBar.tintColor = QP_Color_Background_White;
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
titleLabel.font = [UIFont boldSystemFontOfSize:18];
titleLabel.textColor = QP_Color_Background_White;
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.text=self.title;
self.navigationItem.titleView = titleLabel;
}
- (void)viewWillDisappear:(BOOL)animated{
[superviewWillDisappear:animated];
self.navigationController.navigationBar.barTintColor = QP_Color_Background_Nav;
self.navigationController.navigationBar.tintColor = QP_Color_Text_Nav_title;
}
网友评论