Closed jiasongs closed 1 year ago
经测试,iOS 13-15 都有这个问题,iOS 12 及以下没问题是因为我们在 QMUIThemePrivate 里对 iOS 12 及以下的版本 hook 了 -[UIView setTintColor:]
,主动对 QMUIThemeColor 做一次 copy 从而触发系统的自动刷新。iOS 13 及以上没做这个处理,在手动切换 theme 时就出问题了。
UIImageView 系统没重写 setTintColor:。UIButton 重写了但有调用 super,所以统一在 -[UIView setTintColor:]
内处理即可。
新版本会修复该问题,在此之前可本地修改 QMUIThemePrivate.m 里的 UIView (QMUIThemeCompatibility)
,把 hook -[UIView setTintColor:]
外面判断 iOS 版本的 if 去除即可。
Bug 表现 UIButton.tintColor、UIImageView.tintColor为QMUIThemeColor,Image为UIImageRenderingModeAlwaysTemplate,「手动」切换主题后不生效,但是系统的主题切换是生效的
截图
如何重现 1. 2.在QDThemeViewController.m中点击按钮切换主题
Demo: QMUIDemo_iOS.zip
预期的表现 UIButton.tintColor、UIImageView.tintColor为QMUIThemeColor也可以正常生效
其他信息