0

If I do not add a image into asset ,I just add the image into my Xcode project bundle ,how I name the image so that Xcode can judge it is a dark mode`s image!

1 Answers1

0

Please override the func and provide different image for dark and light mode.

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
    super.traitCollectionDidChange(previousTraitCollection)
    if #available(iOS 12.0, *) {
        let isDark = traitCollection.userInterfaceStyle == .dark ? true : false
        if isDark{
            updateUIForiOS13DarkMode()
        }else{
            updateUIForiOS13LightMode(
        }
    }
}
CrazyPro007
  • 1,006
  • 9
  • 15