如何更改导航栏的字体?如何更改导航栏的字体?
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. 更改Swift导航栏中的字体
- 4. 更改导航栏的字体
- 5. 如何更改导航栏的高度?
- 6. 我如何更改MFMailComposeViewController的导航栏?
- 7. 如何更改导航栏的大小
- 8. 改变字体/导航栏中
- 9. 更改导航栏的UIImagePickerController
- 10. Xamarin.forms如何更改导航栏颜色
- 11. 如何更改导航栏背景
- 12. 如何更改导航栏高度
- 13. 不能更改导航栏中的字体颜色
- 14. 更改不同传送带上的导航栏字体颜色
- 15. 更改按钮字体的文本颜色,在导航栏内
- 16. iPhone导航栏字体
- 17. 导航栏字体颜色
- 18. 更改导航栏按钮
- 19. 更改活动导航栏
- 20. 动态更改导航栏
- 21. 导航栏标题更改
- 22. 导航栏更改高度
- 23. 更改导航栏高度
- 24. 如何修改导航栏
- 25. 如何更改Liferay 6.2中的导航栏和导航栏的颜色
- 26. 如何更改导航栏中titleView的大小。因为有在的导航栏
- 27. 我想更改导航栏字体大小
- 28. Android - 如何更改底部导航栏文本的字体系列
- 29. 如何更改导航栏中按钮文本的字体大小?
- 30. 侧栏导航改为导航栏中的顶部导航栏
接受一个帮助你的答案,这将有助于你在将来获得更多的帮助。 – Bharat