-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请适配ios13暗黑模式 #622
Comments
titleColorNormal无法动态修改 |
暗黑模式跟作者写的组件的出发点是各自独立的,组件只是提供一个如UIPageViewController的容器,暗黑模式说白了就是换肤,找到换肤的时机就好。
|
@Mr-yuwei 我试过的,我监听了dark/light模式的切换通知,在那个方法里修改titleColorNormal不管用 |
@CherishSmile 你可以试试 |
可能我说的有点笼统,其他的属性还好,只要在traitCollectionDidChange这个方法中,重新把menu reload就可以实现适配暗黑模式。但是有一个属性progressColor,它可能对ios13的dynamic color并不支持,如果我设置的color是dynamic color,就会发生莫名奇妙的闪退,具体闪退原因我还没有深究。所以这个属性,要么设置普通的color,要么在traitCollectionDidChange这个方法中,自己判断,重新设置,重新reload。所以我说的适配暗黑模式,就是让它中的的颜色属性,不要因为dynamic color而发生闪退,如果闪退了,那就是它的bug。 |
@CherishSmile 我只想改titleColorNormal的颜色,但是在监听方法中只重新设置这个颜色,是不会改变的。必须得重新reload menu |
解决方法:
|
你这真的麻烦了,不必要这样做。只要你在设置颜色的时候,设置成dynamic color。然后在traitCollectionDidChange这个方法中执行[self.menuView reload]就行了(除了前面说的progressColor,设置成动态的话,会发生莫名的闪退)。 ZTThemeColor和ZTTextPaleGrayColor都是动态颜色。
-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection{ |
但是这样每个页面都会重新加载 |
看清楚呀,不是controller reload,是controller.menuView reload; |
看错了。。 |
请适配ios13暗黑模式 |
请适配ios13暗黑模式
The text was updated successfully, but these errors were encountered: