UITableViewCell更改删除行按钮的字体

时间:2014-10-05 11:10:02

标签: ios objective-c uitableview fonts

是否可以在UITableView

中自定义删除按钮的字体

3 个答案:

答案 0 :(得分:3)

UITableViewCell的删除按钮中使用系统字体。因此,如果您想更改应用中的系统字体,只需覆盖-systemFontOfSize:(CGFloat)fontSize

创建类别UIFont+System并将此代码放在.m

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"

+ (UIFont *)systemFontOfSize:(CGFloat)fontSize {
    return [UIFont fontWithName:@"NameOfYourFont" size:fontSize];
}

#pragma clang diagnostic pop

答案 1 :(得分:0)

也许看看this question

您可以使用包含所需字体的图像,然后将按钮设置为此图像。如果你有不同的语言可能会有问题

答案 2 :(得分:-1)

你可以利用

UIButton * buttonAppearance = [UIButton appearanceWhenContainedInInstancesOfClasses:@[[YourCustomCell class]]];
[buttonAppearance setAttributedTitle: attributedString forState: UIControlStateNormal];

注意:这会将标题设置为单元格中的所有按钮。然后,您可以根据需要进行更改。

相关问题