3

Is it possible to customise the font of the delete button in a UITableView ?

lukas
  • 2,300
  • 6
  • 28
  • 41

3 Answers3

3

In the delete button of UITableViewCell the system font is used. So if you want to change the system font in your app just override -systemFontOfSize:(CGFloat)fontSize:

Create category UIFont+System and place this code inside .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
lukas
  • 2,300
  • 6
  • 28
  • 41
Oleh Kudinov
  • 2,533
  • 28
  • 30
0

Maybe take a look at this question

You could use an image with the font you want and then set the button to this image. May be problematic if you have different languages

Community
  • 1
  • 1
TMob
  • 1,278
  • 1
  • 13
  • 33
-1

You can take advantage of

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

Note: This will set the title to all the buttons in your cells. You can then change it if required.

Bonnie
  • 4,943
  • 30
  • 34