我决定以正确的方式进行自定义导航栏设计。我的导航栏标题应该用自定义字体“Din Condensed”输入,大小为 23。所以我写了这段代码:
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navigation_background.png"]
forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setTitleTextAttributes:@{
UITextAttributeTextColor: [UIColor whiteColor],
UITextAttributeFont: [UIFont fontWithName:@"PFDinTextCondPro-Bold" size:23]
}];
但看起来标题标签不能适合这种字体的文本:
如何使用外观 API 更改 UINavigationBar 标题的大小?我想避免使用自定义titleView。