我有以下用于在 UIButton 中设置文本的代码
[self.fullListButton_ setTitle:[NSString stringWithFormat:@"%d", [self.newsfeedItem_.newsfeedToSubjects count] - 3] forState:UIControlStateNormal];
问题是我似乎无法为此设置字体。我该怎么做?
最佳答案
在较新版本的 iOS 中:
UIButton * myButton;
myButton.titleLabel.font = [UIFont systemFontOfSize: 12];
或任何其他字体机制。
在此处查找 UIButton 部分:
这里是 UIFont 的东西:
在您的代码中:
self.fullListButton_.titleLabel.font = [UIFont systemFontOfSize: 12];
或
self.fullListButton_.titleLabel.font = [UIFont fontWithName:@"Arial" size:12];
关于iphone - 设置 UIButton 字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11443283/