如何更改導航欄的字體?如何更改導航欄的字體?
0
A
回答
1
試試這個代碼,這個是寫在OBJ - C的,但你可以從這裏
[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName,
[UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil]];
得到想法上定製更多的選擇,你可以檢查this nice tutorial
2
嘗試像titleTextAttributes
屬性的屬性.. 。
let attributesDictionary = [NSFontAttributeName: UIFont(name: "your font name", size: 24)!, NSForegroundColorAttributeName : UIColor.whiteColor()]
UINavigationBar.appearance().titleTextAttributes = attributesDictionary
0
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor redColor], NSFontAttributeName:[UIFont fontWithName:@"mplus-1c-regular" size:21]}];
0
如果你想改變字體Ø在斯威夫特
[[UINavigationBar appearance] setTitleTextAttributes:
@{NSFontAttributeName:[UIFont systemFontOfSize:22], // font size
NSForegroundColorAttributeName:[UIColor yellowColor], // foreground color
NSBackgroundColorAttributeName:[UIColor blackColor]}]; // background color
這樣的::F所有的導航欄,您可以在OC做到這一點
UINavigationBar.appearance().titleTextAttributes =
[NSFontAttributeName:UIFont.systemFontOfSize(22), // font size
NSBackgroundColorAttributeName:UIColor.yellowColor(), // background color
NSForegroundColorAttributeName:UIColor.blackColor()] // foreground color
但如果你只是想改變一些特定視圖控制器,你可以在OC做到這一點:
[self.navigationController.navigationBar setTitleTextAttributes:
@{NSFontAttributeName:[UIFont systemFontOfSize:22],
NSForegroundColorAttributeName:[UIColor yellowColor],
NSBackgroundColorAttributeName:[UIColor blackColor]}];
,這在斯威夫特:
self.navigationController?.navigationBar.titleTextAttributes =
[NSFontAttributeName:UIFont.systemFontOfSize(22),
NSForegroundColorAttributeName:UIColor.yellowColor(),
NSBackgroundColorAttributeName:UIColor.blackColor()]
希望這些可以有所幫助。
相關問題
- 1. 更改導航欄字體
- 2. 如何更改UIImagePickerController導航欄字體?
- 3. 更改導航欄的字體
- 4. 更改Swift導航欄中的字體
- 5. 我如何更改MFMailComposeViewController的導航欄?
- 6. 更改導航欄的UIImagePickerController
- 7. 如何更改導航欄高度
- 8. 更改不同傳送帶上的導航欄字體顏色
- 9. 不能更改導航欄中的字體顏色
- 10. 更改按鈕字體的文本顏色,在導航欄內
- 11. UIActivityViewController更改導航欄文字顏色
- 12. 導航欄字體顏色
- 13. 導航欄標題更改
- 14. 更改導航欄按鈕
- 15. 更改活動導航欄
- 16. 導航欄更改高度
- 17. 如何更改導航欄中titleView的大小。因爲有在的導航欄
- 18. 我想更改導航欄字體大小
- 19. 側欄導航改爲導航欄中的頂部導航欄
- 20. Android - 如何更改底部導航欄文本的字體系列
- 21. 如何更改Ionic 2中的標題欄/導航欄
- 22. 改變一個元素的字體顏色導航欄引導
- 23. 導航欄如何標題字體顏色字體樣式
- 24. 單擊導航欄切換時如何更改導航欄顏色
- 25. 引導導航欄:overiding字體顏色
- 26. 如何更改下拉導航文字字體和顏色?
- 27. 如何更改引導程序導航欄的顏色?
- 28. 如何更改導航項目的字體?
- 29. 更改摺疊的導航欄顏色
- 30. 更改導航欄UIImagePickerController的標題
接受一個幫助你的答案,這將有助於你在將來獲得更多的幫助。 – Bharat