iOS修改導航條title字型顏色
阿新 • • 發佈:2019-01-23
1、第一種方法
= [UIColor
blackColor];
self.title = @"title";
[self.navigationController.navigationBarsetTitleTextAttributes:
@{NSFontAttributeName:[UIFontsystemFontOfSize:19],
NSForegroundColorAttributeName:[UIColorredColor]}];
1、第二種方法
//自定義標題檢視
UILabel *navTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 150, 40)];
navTitleLabel.backgroundColor
navTitleLabel.font = [UIFont boldSystemFontOfSize:25];
navTitleLabel.textColor = [UIColor greenColor];
navTitleLabel.textAlignment = NSTextAlignmentCenter;
navTitleLabel.text = @"title";
self.navigationItem.titleView = navTitleLabel;