Tencent / QMUI_iOS

QMUI iOS——致力于提高项目 UI 开发效率的解决方案
http://qmuiteam.com/ios
Other
7.05k stars 1.37k forks source link

qmui_setTitleAttributes 无效 #1496

Open huiyumiao opened 1 year ago

huiyumiao commented 1 year ago

QMUIButton *btn = [[QMUIButton alloc]init]; btn.imagePosition = QMUIButtonImagePositionLeft; btn.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 4); [btn setImage:[UIImageMake(imageStr) qmui_imageWithTintColor:JLStyle.mainColor] forState:UIControlStateSelected]; [btn setImage:[UIImageMake(imageStr) qmui_imageWithTintColor:JLStyle.gray99] forState:UIControlStateNormal]; [btn qmui_setTitleAttributes:@{NSFontAttributeName:UIFontBoldMake(16),NSForegroundColorAttributeName:JLStyle.mainColor} forState:UIControlStateSelected]; [btn qmui_setTitleAttributes:@{NSFontAttributeName:UIFontMake(16),NSForegroundColorAttributeName:JLStyle.gray99} forState:UIControlStateNormal]; [btn setTitle:title forState:UIControlStateNormal]; btn.titleLabel.adjustsFontSizeToFitWidth = YES; 在 4.1.3 版本是正常的,升级到最新的 4.6.3 就无效了

MoLice commented 1 year ago

试试先设置 normal 再设置别的 state 呢?

huiyumiao commented 1 year ago

试试先设置 normal 再设置别的 state 呢?

还是不行