0

I know there are a variety of ways to do make different font sizes for different sized devices, but unsure how to go about implementing them and the pros/cons of each. Would you mind helping me out? Thanks in advance

  • 2
    Hello and welcome to [SO].Please take time out for a [tour] and visit the [help]. You might also want to read [ask]. – Sampada Aug 05 '16 at 06:15

1 Answers1

0

Here is how I implemented it. Made a class function in appconfig to get the scaling factor for iphone 6 and iphone 6 plus

+(NSInteger)scalingFactor {
    NSInteger scalingFactor = 0;
    if (IS_IPHONE6) {
        scalingFactor = 1.0;
    }
    else if (IS_IPHONE6_PLUS){
        scalingFactor = 2.0;
    }

    return scalingFactor;
}

Then used the scaling factor wherever I need it.

+ (UIFont *) fontForSearchCancelButtonTitle{
    return [UIFont proximaNovaLightFontOfSize:17.0f + [AppConfig scalingFactor]];
}

And for getting iphone 6 and iphone 6 plus:

#define IS_IPHONE6 (([[UIScreen mainScreen] bounds].size.height-667)?NO:YES)
#define IS_IPHONE6_PLUS (([[UIScreen mainScreen] bounds].size.height-736)?NO:YES)
Kunal
  • 227
  • 3
  • 9
  • Thank you @Kunal..its working awesome..but i want to set with in attribute inspector... – Vivid Tester Aug 05 '16 at 06:23
  • http://i.stack.imgur.com/nszta.png check the above image.we are using minimum font scale its working fine in system font but custom font does not working... – Vivid Tester Aug 05 '16 at 06:41
  • yup not working for me as well. You might want to have a look at http://stackoverflow.com/questions/26166737/custom-font-sizing-in-xcode6-size-classes-not-working-properly-w-custom-fonts – Kunal Aug 05 '16 at 07:02