简体   繁体   中英

Custom Dark Mode iOS Issue

Three enums are set to achieve: UIUserInterfaceStyleUnspecified -> To listen to iOS setting mode change UIUserInterfaceStyleLight -> To override LIGHT mode irrespective of iOS setting mode UIUserInterfaceStyleDark -> To override DARK mode irrespective of iOS setting mode

The problem arises when I set

(Parent_ViewController -> UIUserInterfaceStyleDark) and

(Child_ViewController -> UIUserInterfaceStyleUnspecified)

And then when we switch the settings iOS mode from light to dark or vice versa, there's no change in UI of Child_ViewController and being UIUserInterfaceStyleUnspecified it should've changed but it always has dark theme colors.

Any workarounds or solution is there to address this problem?

Welcome!

ViewControllers will stop propagating the system changes to child controllers when they override the interface style. This also means that a child VC will inherit the interface style of its parent when overrideUserInterfaceStyle is set to .unspecified .

I'm afraid you need some custom implementation if you want to achieve that specific behavior. For instance, by setting the parts you always want to be dark to concrete (undynamic) colors instead of using dynamic system colors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM