UITableViewCell change font of line delete button

Can I customize the delete button's font UITableView

?

+3


source to share


3 answers


The delete button UITableViewCell

uses the system font. Therefore, if you want to change the system font in your application, just override -systemFontOfSize:(CGFloat)fontSize

:

Create a category UIFont+System

and put 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

      

+2


source


Maybe look at this question



You can use an image with the font you want and then set a button for that image. Can be problematic if you have different languages

0


source


You can use

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

      

Note. This sets the title for all buttons in your cells. Then you can change it.

-1


source







All Articles