Skip to content

0x008-iOS系统粗体时,UIButton文字显示不全

iOS17上系统设置为粗体时,UIButton文字显示不全(使用了autolayout)。查询了下,早在iOS13版本就有问题反馈这个问题。

解决方案1:

swift
button.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, -1)
button.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, -1)

解决方案2:

swift
button.titleLabel.lineBreakMode = NSLineBreakByClipping;
button.titleLabel.lineBreakMode = NSLineBreakByClipping;

相关讨论:
https://github.com/Tencent/QMUI_iOS/issues/1452
https://www.jianshu.com/p/df36e441392c
https://zeroonet.com/2019/03/30/bold-text/