美文网首页iOS经验总结
iOS中设置导航栏标题的字体颜色和大小

iOS中设置导航栏标题的字体颜色和大小

作者: 我一不小心就 | 来源:发表于2018-04-03 13:35 被阅读0次

方案1:

[self.navigationController.navigationBar setTitleTextAttributes:
     @{NSFontAttributeName:[UIFont systemFontOfSize:19.0f],
       NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#FFFFFF"]}];

方案2:在导航上添加一个titleView,可以使用一个UILable,再设置label的背景颜色透明,字体,即:自定义一个自定义标题视图

UILabel *titleLabel = [[UILabel 
alloc] initWithFrame:CGRectMake(0, 
0, 200, 44)];
// 设置titleLabel的各种属性
xxxxxx
xxxxx
xxx
// 最后
self.navigationItem.titleView = titleLabel;

相关文章

网友评论

    本文标题:iOS中设置导航栏标题的字体颜色和大小

    本文链接:https://www.haomeiwen.com/subject/jaiqhftx.html