runtime 方法交换
//
// UIFont+font.m
// lzPhoneApp
//
// Created by zhuchangming on 2018/1/4.
// Copyright © 2018年 bestseller. All rights reserved.
//
#import "UIFont+font.h"
#import <objc/runtime.h>
@implementation UIFont (font)
+(void)load{
Method newMethod = class_getClassMethod([self class], @selector(adjustFont:));
Method method = class_getClassMethod([self class], @selector(systemFontOfSize:));
method_exchangeImplementations(newMethod, method);
newMethod = class_getClassMethod([self class], @selector(boldAdjustFont:));
method = class_getClassMethod([self class], @selector(boldSystemFontOfSize:));
method_exchangeImplementations(newMethod, method);
}
+(UIFont *)adjustFont:(CGFloat)fontSize{
return [UIFont adjustFont:IS_IPHONE_5?fontSize * 0.8:[Tools isIpad]?fontSize * 0.8:fontSize];
}
+(UIFont *)boldAdjustFont:(CGFloat)fontSize{
return [UIFont adjustFont:IS_IPHONE_5?fontSize * 0.8:[Tools isIpad]?fontSize * 0.8:fontSize];
}
@end