2

I want to create a Category suppose of UILabel so using which for every device we can change the font size of text as need

Ahmed Sahib
  • 213
  • 3
  • 13

1 Answers1

1

You can create a category class , and add a method like :

+(UIFont *)fontWithName:(NSString *)fontName {
    CGFloat fontSize = 14.0;
    if (IS_IPHONE6) {
        fontSize = 15.0;
    }
    if (IS_IPHONE6P) {
        fontSize = 16.0;
    }
    return [UIFont fontWithName:fontName size:fontSize];
}

About device's size: iphone6 = iphone7 & 6plus = 7plus.

lostInTransit
  • 70,519
  • 61
  • 198
  • 274
AngelSunpx
  • 11
  • 1
  • ya but to change the font of label i have to call every object of UIlabel using i have created but i don't want to do – Ahmed Sahib Feb 17 '17 at 09:30
  • oh I see, you need a global method like a define to control the size, if I have time out of work, I will test some. – AngelSunpx Feb 20 '17 at 10:27