更改UIBarButtonItem的字体 [英] Change the font of a UIBarButtonItem

查看:74
本文介绍了更改UIBarButtonItem的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我的 UIToolbar 中名为 Done UIBarButtonItem 。现在,我想使用粗体将字体从默认字体更改为 Trebuchet MS 。我该怎么办?

I have a UIBarButtonItem in my UIToolbar titled Done. Now I want to change the font from the default to "Trebuchet MS" with Bold. How can I do that?

推荐答案

由于UIBarButtonItem继承自UIBarItem,因此可以尝试

Because UIBarButtonItem inherits from UIBarItem, you can try

- (void)setTitleTextAttributes:(NSDictionary *)attributes
                  forState:(UIControlState)state

,但这仅适用于iOS5。对于iOS 3/4,您将必须使用自定义视图。

but this is for iOS5 only. For iOS 3/4, you will have to use a custom view.

这篇关于更改UIBarButtonItem的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆