我決定自定義導航欄設計的正確方法。我的導航欄的標題應該與自定義字體「DIN簡明」有大小23鍵入所以我寫了這個代碼:如何更改UINavigationBar標題標籤大小?
[[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。
謝謝你,Guntis。 –