简体   繁体   中英

Dark mode does not switch to a Dark mode background in Xcode

I have set up different backgrounds for ' Light/Dark Appearance '

在此处输入图像描述

But when switching between Light/Dark mode within Xcode , my background always uses image from ' Any/Light Appearance '. Only colours set for icons changes accordingly.

在此处输入图像描述

FYI: I'm switching between Light/Dark mode using Interface Style option.

在此处输入图像描述

Can someone please advice what I'm missing on? It's all new to me.

I think it is an Xcode bug. You can confirm it by changing your setting in the iOS Simulator.

Go to Settings -> Developer -> Dark Appearance

I think you might need to uncheck the Resizing checkbox and set the Scales property to Single Scale. It worked for me.

在此处输入图片说明

将图像设置为渲染为原始图像

I think it's an Xcode (latest version) bug.

If you run it on your phone, you won't have this problem. Meaning settings are correct.

In Simulator it's working fine. One can confirm by toggling the Appearance from feature menu of the simulator.

这似乎是一个 Xcode 错误,但是当您尝试在模拟器或物理设备上运行它时,假设您处于黑暗模式,它应该可以完美运行。

By unchecking the Preserve Vector Data option 1 , one can see the change in the background when switching between the modes from interface styles 2 .

But I noticed that if you leave the option selected and test it on the simulator, it works perfectly fine there. Hence I feel it's an Xcode bug too.

在此处输入图片说明

在此处输入图片说明

The Xcode Bug is still here, Xcode storyboard appearance switcher does not work, it only works in the simulator.
You can change the simulator device appearance: Settings> Developer> Dark Appearance.


Happy coding.

On my physical device iPhone 8 iOS 14.6 dark Mode doesn't work. traitCollectionDidChange not get called after switching to dark mode. On my iPhone 12 iOS 15.x, and some testers it works. No Solution i tried worked. Also i got some other weird UI bugs aswell on my iPhone 8.

Hope its just an Xcode Bug.

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