设置UIButton字体 [英] setting UIButton font

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

问题描述

我有以下代码在UIButton中设置文本

I have the following code for setting up text in a UIButton

[self.fullListButton_ setTitle:[NSString stringWithFormat:@"%d", [self.newsfeedItem_.newsfeedToSubjects count] - 3] forState:UIControlStateNormal];

问题是我似乎无法为此设置字体。我该怎么做?

The issue is I can't seem to set the font for this. How do I do so?

推荐答案

在较新版本的iOS中:

In the newer version of iOS:

UIButton * myButton;
myButton.titleLabel.font = [UIFont systemFontOfSize: 12];

或任何其他字体机制。

在这里查看UIButton部分:

Look here for the UIButton portions:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIButton_Class/UIButton/UIButton.html#// apple_ref / occ / instp / UIButton / titleLabel

这里是UIFont的东西:

And here for the UIFont stuff:

http://developer.apple.com/library/ios/# documentation / uikit / reference / UIFont_Class / Reference / Reference.html

在您的代码中:

self.fullListButton_.titleLabel.font = [UIFont systemFontOfSize: 12];

self.fullListButton_.titleLabel.font = [UIFont fontWithName:@"Arial" size:12];

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

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