Reputation: 5420
I am facing problem with a iOS project with Xcode 12.3. App is designed for both light and dark mode and it is working fine if we are changing light/dark mode while app is closed but if send app in background and change mode and resume app then current UIViewController not updating dark/light mode. You can check that in below.
Upvotes: 1
Views: 1767
Reputation: 81
When User Interface Style is changed then system call func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?)
this delegate methods
please refresh your programatic assigned colors in this methods
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if(traitCollection.userInterfaceStyle == .dark){
// set your Dark UI
} else {
// set your Light UI
}
}
Upvotes: 1