Skip to content

Commit

Permalink
修复 iOS 13 系统的 UIButton 在开启了 Bold Text 后文字被截断的 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLice committed Jun 12, 2019
1 parent bab11c1 commit 2f8dc48
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions QMUIKit/UIKitExtensions/UIButton+QMUI.m
Expand Up @@ -83,6 +83,15 @@ + (void)load {
ExtendImplementationOfVoidMethodWithTwoArguments([UIButton class], @selector(setAttributedTitle:forState:), NSAttributedString *, UIControlState, ^(UIButton *selfObject, NSAttributedString *title, UIControlState state) {
[selfObject _markQMUICustomizeType:QMUICustomizeButtonPropTypeAttributedTitle forState:state value:title];
});

if (@available(iOS 13, *)) {
ExtendImplementationOfVoidMethodWithoutArguments([UIButton class], @selector(layoutSubviews), ^(UIButton *selfObject) {
// 临时解决 iOS 13 开启了粗体文本(Bold Text)导致 UIButton Title 显示不完整 https://github.com/Tencent/QMUI_iOS/issues/620
if (UIAccessibilityIsBoldTextEnabled()) {
[selfObject.titleLabel sizeToFit];
}
});
}
});
}

Expand Down

0 comments on commit 2f8dc48

Please sign in to comment.