Created
October 25, 2013 05:17
-
-
Save objectiveSee/7149720 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UIFont (CustomSystemFont) | |
// swizzle methods for system fonts so we can use | |
+ (void)load | |
{ | |
Method orig = class_getClassMethod([UIFont class], @selector(systemFontOfSize:)); | |
Method swiz = class_getClassMethod([UIFont class], @selector(_systemFontOfSize:)); | |
method_exchangeImplementations(orig, swiz); | |
orig = class_getClassMethod([UIFont class], @selector(boldSystemFontOfSize:)); | |
swiz = class_getClassMethod([UIFont class], @selector(_boldSystemFontOfSize:)); | |
method_exchangeImplementations(orig, swiz); | |
orig = class_getClassMethod([UIFont class], @selector(italicSystemFontOfSize:)); | |
swiz = class_getClassMethod([UIFont class], @selector(_italicSystemFontOfSize:)); | |
method_exchangeImplementations(orig, swiz); | |
} | |
+ (UIFont *)_systemFontOfSize:(CGFloat)fontSize | |
{ | |
return [UIFont fontWithName:@"Helvetica" size:fontSize]; | |
} | |
+ (UIFont *)_boldSystemFontOfSize:(CGFloat)fontSize | |
{ | |
return [UIFont fontWithName:@"Helvetica-Bold" size:fontSize]; | |
} | |
+ (UIFont *)_italicSystemFontOfSize:(CGFloat)fontSize | |
{ | |
return [UIFont fontWithName:@"Helvetica-Light" size:fontSize]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment