ios-darkmode

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

核能气质少年 提交于 2019-12-17 03:47:11
问题 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? 回答1: First, here is Apple's entry related to opting out of dark mode. The content at this link is written for Xcode

Normal and Dark Mode implementation on both Android and iOS without the flashes using Xamarin.Forms 4.3.0.947036

走远了吗. 提交于 2019-12-13 03:39:36
问题 After some discussion on the Original Post, we needed to open a new question for its answer due to an issue found with iOS . The Problem: After attempting this and troubleshooting the results, the iOS async code doesn't work correctly. While Android works ok, the code below in App() doesn't seem to work correctly for iOS , as I apparently can't have await -ables in the App() which is needed to get the coloring correct when navigating. Theme theme = await DependencyService.Get<IEnvironment>()

UILabel subclass ignores foregroundColor in Attributed string when label uses a named color

半世苍凉 提交于 2019-12-11 17:43:41
问题 I just came across a very strange problem in a custom UILabel subclass and I need some help to figure out what is going on. The question appears to be pretty long, but this is mostly due to the images I have added to illustrate the problem as good as possible :-) Thank you very much for your help! The MyHTMLLabel class uses the awakeFromNib() method to parse its text property for HTML like <hightlight> tags to show the text between these tags in a a different color. This has worked without

Evaluating UITraitCollection's hasDifferentColorAppearance(comparedTo:) result

[亡魂溺海] 提交于 2019-12-11 03:35:45
问题 In my app I need to make some custom UI changes when iOS system dark mode settings change. According to https://developer.apple.com/videos/play/wwdc2019/214/ it's explicitly mentioned to implement traitCollectionDidChange and compare the previous and current trait collection using hasDifferentColorAppearance(comparedTo:) . Documentation says: Use this method to determine whether changing the traits of the current environment would also change the colors in your interface. For example,

Fallback behavior for new iOS 13 system colors in iOS 12

▼魔方 西西 提交于 2019-12-10 10:29:21
问题 I’m currently adopting to Dark Mode and I figured that using the new system colors like systemBackground and label in Interface Builder also just works when running the app in iOS 12. I half expected to get a compiler error, but instead the app looks like in iOS 13 light mode. So obviously the runtime somehow translates those colors for iOS 12. Does anyone know what happens under the hood and if there is a convenient way to achieve the same in code? 回答1: If you look at the XML of the

How we Support Dark Mode in Current iOS App with iOS 13?

喜欢而已 提交于 2019-12-06 06:34:54
问题 My current app is developed in objC and Swift both. i need to support a darkmode. can anyone suggest how can i achieve this by globally? 回答1: Here is the code for adding your color logic should appear in the dark mode. if self.traitCollection.userInterfaceStyle == .dark { //Add your Dark mode colors here } else { //Your normal colors should appear here } To know more about adapting dark mode in your iOS application please refer to the following blog post. How to Adopt iOS 13 Dark Mode in your

How to use dark mode in simulator iOS 13?

余生颓废 提交于 2019-12-04 01:47:07
While I am developing the iOS app I need to test it in simulator with dark mode option so I can get more clarity about the app UI. But when I go to the Setting I am not getting option for dark mode as real device showing. In Settings , scroll down to Developer and then Dark Appearance … You can toggle the interface mode (i.e. Light / Dark) as well as adjust dynamic type setting on the fly (when the simulator is running) like this: Alternatively, you can also switch the appearance programmatically ( docs ): override func viewDidLoad() { super.viewDidLoad() #if DEBUG // change the appearance

hasDifferentColorAppearance is true when app is backgrounded

末鹿安然 提交于 2019-12-01 23:43:14
Apple recommends that we use traitCollectionDidChange and compare trait collections using hasDifferentColorAppearance to catch when dark mode is toggled, and act on it if we need to. Like this: override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { super.traitCollectionDidChange(previousTraitCollection) if #available(iOS 13.0, *) { let hasUserInterfaceStyleChanged = previousTraitCollection?.hasDifferentColorAppearance(comparedTo: traitCollection) ?? false if (hasUserInterfaceStyleChanged) { //Update UI } } } I use this to update the UI, clear some caches etc

How to use dark mode in simulator iOS 13?

ⅰ亾dé卋堺 提交于 2019-11-29 17:07:01
问题 While I am developing the iOS app I need to test it in simulator with dark mode option so I can get more clarity about the app UI. But when I go to the Setting I am not getting option for dark mode as real device showing. 回答1: In Settings , scroll down to Developer and then Dark Appearance … 回答2: You can toggle the interface mode (i.e. Light / Dark) as well as adjust dynamic type setting on the fly (when the simulator is running) like this: 回答3: Alternatively, you can also switch the

How can I check whether dark mode is enabled in iOS/iPadOS?

半世苍凉 提交于 2019-11-29 11:26:32
问题 Starting from iOS/iPadOS 13, a dark user interface style is available, similar to the dark mode introduced in macOS Mojave. How can I check whether the user has enabled the system-wide dark mode? 回答1: You should check the userInterfaceStyle variable of UITraitCollection , same as on tvOS and macOS. switch traitCollection.userInterfaceStyle { case .light: //light mode case .dark: //dark mode case .unspecified: //the user interface style is not specified } You should use the