需要解決的問題
iOS7之后烘挫,在 設(shè)置->通用->輔助功能->按鈕形狀 打開后,界面會從
變成
解決辦法
- UITabbar
[UITabBar appearance].selectionIndicatorImage = [UIImage new];
- UIButton 給UIButton添加了一個分類
+ (void)load {
//只執(zhí)行一次這個方法
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[UIButton changeFontBottomLine];
});
}
#pragma mark - Change Font Bottom Line
+ (void)changeFontBottomLine {
Class class = [self class];
SEL originalSelector = @selector(setTitle:forState:);
SEL swizzledSelector = @selector(CKSetTitle:forState:);
Method originalMethod = class_getInstanceMethod(class, originalSelector);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
BOOL didAddMethod =
class_addMethod(class,
originalSelector,
method_getImplementation(swizzledMethod),
method_getTypeEncoding(swizzledMethod));
if (didAddMethod) {
class_replaceMethod(class,
swizzledSelector,
method_getImplementation(originalMethod),
method_getTypeEncoding(originalMethod));
} else {
method_exchangeImplementations(originalMethod, swizzledMethod);
}
}
- (void)CKSetTitle:(NSString *)title forState:(UIControlState)state {
[self CKSetTitle:title forState:state];
NSDictionary *attrbiteDic = @{
NSFontAttributeName:self.titleLabel.font,
NSForegroundColorAttributeName:[self titleColorForState:state],
NSUnderlineStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleNone]
};
self.titleLabel.attributedText = [[NSAttributedString alloc] initWithString:title attributes:attrbiteDic];
}