ios-darkmode

How to Check for iOS Dark Mode? [duplicate]

心已入冬 提交于 2019-11-28 22:28:24
问题 This question already has an answer here: How can I check whether dark mode is enabled in iOS/iPadOS? 9 answers • How to observe dark mode state in an iOS app • How to react to changes in dark mode state in an iOS app 回答1: UIKit has had UITraitCollection for a while now. Since iOS 9 you could use UITraitCollection to see whether the device supports 3D Touch (a sad conversation for another day) In iOS 12, UITraitCollection got a new property: var userInterfaceStyle: UIUserInterfaceStyle which

iOS 13 disable Dark Mode changes [duplicate]

99封情书 提交于 2019-11-28 11:53:38
This question already has an answer here: Is it possible to opt-out of dark mode on iOS 13? 4 answers My application isn't prepared for Dark Mode and I'm not going to work on it today. Is there a way to disable Dark Mode changes for my app? Here is where Apple discusses opting out of light or dark mode: This section applies to Xcode 11 usage The code below will opt out a specific view controller: override func viewDidLoad() { super.viewDidLoad() // overrideUserInterfaceStyle is available with iOS 13 if #available(iOS 13.0, *) { // Always adopt a light interface style.

How to detect Light\Dark mode change in iOS 13?

流过昼夜 提交于 2019-11-28 08:58:27
问题 Some of the UI setups not working automatically with the Dark/Light mode change as the UIColor . For example shadow in layer. As I need to remove and drop shadow in dark and light mode, I need somewhere to put updateShadowIfNeeded() function. I know how to detect what is the mode currently: func dropShadowIfNeeded() { switch traitCollection.userInterfaceStyle { case .dark: removeShadow() case .light: dropShadowIfNotDroppedYet() default: assertionFailure("Unknown userInterfaceStyle") } } Now I

Is it possible to opt-out of dark mode on iOS 13?

不打扰是莪最后的温柔 提交于 2019-11-28 00:56:50
A large part of my app consists of web views to provide functionality not yet available through native implementations. The web team has no plans to implement a dark theme for the website. As such, my app will look a bit half/half with Dark Mode support on iOS 13. Is it possible to opt out of Dark Mode support such that our app always shows light mode to match the website theme? According to Apple's "Implementing Dark Mode on iOS" Session ( https://developer.apple.com/videos/play/wwdc2019/214/ starting at 31:13) it is possible to set overrideUserInterfaceStyle to UIUserInterfaceStyleLight or