[分享]iOS开发-设置NavigationBar的颜色和字体属性

代码如下:

#define kColorBarTint   [UIColor colorWithRed:56/255.0 green:170/255.0 blue:27/255.0 alpha:1.0]


#import "SSMyViewController.h"

@interface SSMyViewController ()

@end

@implementation SSMyViewController

-(void)viewDidLoad {
    [super viewDidLoad];
    //set NavigationBar 背景颜色&title 颜色
    [self.navigationController.navigationBar setBarTintColor:kColorBarTint];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:22],NSForegroundColorAttributeName:[UIColor whiteColor]}];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
}

-(void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}



@end
    原文作者:ShevaKuilin
    原文地址: https://segmentfault.com/a/1190000004555117
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞