I'm hoping to customize all of the fonts in my app, and have been using the [UILabel appearance]
API so far as it seems like the path of least resistance.
I noticed that this also affects the labels inside of the UIAlertView
(as expected), but I'm also aware that customizing the alert view may cause an app to get rejected.
Does anyone have any experience with this? Should I just make my own subclass of UILabel
instead and apply it manually to each label in my app?
UILabel class conforms to the UIAppearanceContainer protocol, a check of UILabel.h shows that none of its properties are marked with UI_APPEARANCE_SELECTOR, the prerequisite for the use of UIAppearance. So you need to create UILabel subclass as shown below.
@interface SmallLabel : UILabel
@end
@implementation SmallLabel
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
}
return self;
}
@end
I think you can alsotry in your subclass something like:
UIFont *newFont = [UIFont fontWithName:@"YourFontName" size:self.font.pointSize];
self.font = newFont