0

I am able to change the language of my iOS app on the fly without terminating the app. However, I want to change the system fonts on the fly too because the standard Helvetica Neue fonts don't look good with some languages. I'm going to use a category from this SO answer and include it in my .pch:

@implementation UIFont (SytemFontOverride)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"

+ (UIFont *)systemFontOfSize:(CGFloat)fontSize {
    return [UIFont fontWithName:@"FONT NAME" size:fontSize];
}

#pragma clang diagnostic pop
@end

However, when in English I want to use the default system fonts which vary slightly from iOS version and device. My question is how can I achieve something like this

static UIFont *defaultRegularFont = [UIFont systemFontOfSize:12];  

so I can reuse it when the app switches back to English like this

+ (UIFont *)systemFontOfSize:(CGFloat)fontSize {
    ...
    // If English
    return [UIFont fontWithName:[defaultRegularFont fontName] size:fontSize];
}
Community
  • 1
  • 1
Drakes
  • 23,254
  • 3
  • 51
  • 94

0 Answers0