当我在Mojave下的Xcode 10中构建我的macOS应用程序时,它会自动使我的应用程序采用暗模式 . 我尚未准备好为我的应用程序实现黑暗模式 .
如何禁用我的应用程序的暗模式,因此在macOS下的浅色和暗色模式下都显示为aqua?
来自Supporting Dark Mode in Your Interface: Choosing a Specific Appearance for Your App – Opt Out of Dark Mode:
与macOS 10.14或更高版本链接的应用程序应支持浅色和深色外观 . [...]如果您需要额外的时间来处理应用程序的暗模式支持,您可以通过在应用程序的Info.plist文件中包含NSRequiresAquaSystemAppearance键(值为YES)暂时退出 . 将此键设置为YES会导致系统忽略用户的偏好,并始终将轻巧的外观应用于您的应用 .
if (@available(macOS 10.14, *)) { NSApp.appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua]; }
见documentation .
2 回答
来自Supporting Dark Mode in Your Interface: Choosing a Specific Appearance for Your App – Opt Out of Dark Mode:
见documentation .