Tencent / QMUI_iOS

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

开启系统辅助功能粗体文本的情况下,设置了 tintColorAdjustsTitleAndImage 的 QMUIButton 在 App 切到桌面再切回来时颜色错误 #1452

Closed MoLice closed 1 year ago

MoLice commented 1 year ago

Bug 表现

https://user-images.githubusercontent.com/1190261/195459696-559f11cd-d4ea-45b7-bdb2-a6174777c6fe.mp4

经测试,和以下几个因素有关系:

  1. 4.5.1 里为 #1418 放开的 -[UIView setTintColor:] 的 hook,每次都把 tintColor 做一次 copy。把这段去掉就没问题。
  2. QMUIThemePrivate 里为 QMUIButton 注册的 @selector(tintColorAdjustsTitleAndImage),把这个去掉就没问题。
  3. QMUIButton.tintColor 每次设置时会被 copy,但 QMUIButton.tintColorAdjustsTitleAndImage 却一直都是原始的值,所以如果结合第2点,切换 theme 时就会导致调用 setTintColorAdjustsTitleAndImage: 时把旧的 tintColor 又重新设置给 self.tintColor。

但暂不清楚为什么关闭粗体文本就没问题。

其他信息

MoLice commented 1 year ago

已修复该问题,请根据 iOS 版本支持情况选择升级到 4.6.0(iOS 11-16)4.6.1(iOS 13-16)