I have the following code in my didFinishLaunchingWithOptions function :
[[[UITableViewCell appearance] textLabel]setFont:[UIFont fontWithName:@"someFont" size:12]];
But for some reason this does not change the text in my table cells.
If in the table delegate function cellForRowAtIndexPath I add
cell.textLabel.font = [UIFont fontWithName:@"someFont" size:12];
It does change the font to my desired one.
Any ideas?
Setting the font property of a UITableViewCell is not supported using the appearance proxy.
You can tell which properties are supported by looking in the header file for that class for UI_APPEARANCE_SELECTOR.
Take a look at UITableViewCell.h and you'll see that only separatorInset is supported (and backgroundColor as this is supported by its superclass, UIView):
@property (nonatomic) UIEdgeInsets separatorInset NS_AVAILABLE_IOS(7_0) UI_APPEARANCE_SELECTOR; // allows customization of the separator frame
From the UIAppearance protocol reference:
To support appearance customization, a class must conform to the
UIAppearanceContainerprotocol and relevant accessor methods must be marked withUI_APPEARANCE_SELECTOR.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With