Here is the Objective-C Runtime solution:
@interface UIFont (CustomSystemFont)
+ (UIFont *)ln_systemFontOfSize:(CGFloat)fontSize;
+ (UIFont *)ln_boldSystemFontOfSize:(CGFloat)fontSize;
+ (UIFont *)ln_italicSystemFontOfSize:(CGFloat)fontSize;
@end
@implementation UIFont (CustomSystemFont)
+ (void)load
{
Method orig = class_getClassMethod([UIFont class], @selector(systemFontOfSize:));
Method swiz = class_getClassMethod([UIFont class], @selector(ln_systemFontOfSize:));
method_exchangeImplementations(orig, swiz);
orig = class_getClassMethod([UIFont class], @selector(boldSystemFontOfSize:));
swiz = class_getClassMethod([UIFont class], @selector(ln_boldSystemFontOfSize:));
method_exchangeImplementations(orig, swiz);
orig = class_getClassMethod([UIFont class], @selector(italicSystemFontOfSize:));
swiz = class_getClassMethod([UIFont class], @selector(ln_italicSystemFontOfSize:));
method_exchangeImplementations(orig, swiz);
}
+ (UIFont *)ln_systemFontOfSize:(CGFloat)fontSize
{
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f)
{
//Call original implementation.
return [self ln_systemFontOfSize:fontSize];
}
return [UIFont fontWithName:@"HelveticaNeue" size:fontSize];
}
+ (UIFont *)ln_boldSystemFontOfSize:(CGFloat)fontSize
{
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f)
{
//Call original implementation.
return [self ln_systemFontOfSize:fontSize];
}
return [UIFont fontWithName:@"HelveticaNeue-Medium" size:fontSize];
}
+ (UIFont *)ln_italicSystemFontOfSize:(CGFloat)fontSize
{
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f)
{
//Call original implementation.
return [self ln_systemFontOfSize:fontSize];
}
return [UIFont fontWithName:@"HelveticaNeue-Italic" size:fontSize];
}
@end
What I do in this example is replace the three system font methods with my own and test to see if the system version is 7 or up. If it is, I use the original methods, otherwise return a font of my choosing (in this case Helvetica Neue with UltraLight weight for regular and italic requests, and Medium weight for bold requests).
This works for everything generated in code, including system created views. It does not work when loading views from Xib and Storyboard files, because the fonts are hardcoded in the NIB file itself. Use the font picker to choose the font you need.