How to use custom font without size?

ios

Solution

Create category for UILabel and add the following code over there.

@implementation UILabel (CustomFontLabel)

-(void)awakeFromNib{
    float size = [self.font pointSize];
    self.font = [UIFont fontWithName:@"MyCustomFont" size:size];
}

@end

Problem

I want to use a custom font in whole app (ios 5). I used the following code ``` [[UILabel appearance] setFont:[UIFont fontWithName:@"MyCustomFont" size:17.0]]; ``` The problem with this is that it overrides all font sizes in all views. How can i avoid it?

Original source