iOS UIAlertController Dark Theme - ios

I'm working on an app for iOS with a dark theme and I want to use a UIAlertController. However, the white alert looks out of place. Would it be against the Human Interface Guidelines even on a dark themed app to use a dark themed UIAlertController (when I say dark themed alert all I mean is switching the white background to a dark grey and the text to white this also includes the buttons).
Assuming it's not against the guidelines how would I go about achieving this? I can't seem to find a theme for the UIAlertController that would allow this.

With iOS 13, Apple provides Dark Mode. But if your App theme doesn't match with Device Theme, you can set your view controller's theme.
For eg, My Device Appearance is Dark Mode, and my App is always in light mode. But the popups using UIAlertController are following Device Theme, Dark theme, and a black popup over my white screen doesn't match.
Solution #1: Inline Solution
While creating the UIAlertController, I can set its theme
alert.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
Solution #2: Support for Whole App
In you AppDelegate, set the theme for window
self.window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
This will cause all the popups to use light theme.
Note: UIAlertView won't use the dark/light theme if you set its overrideUserInterfaceStyle property.
Also, don't forget to add if #available(iOS 13.0, *) check before setting the property, as it is available only in iOS 13+

Well, customizing UIAlertView/UIAlertController is not possible, but there's a plenty of custom Alert implementations on CocoaControls, just take a look there. It's more a philosophical question; I guess it doesn't really violate anything.

Related

iOS WKWebView loading PDF data in DarkMode has black background around PDF document

After update to iOS 13 I have experienced problem with loading PDF document into WKWebView.
PDF document was displayed on light gray background in Light Mode. But now in iOS 13 I can change system configuration to Dark Mode. The problem is that PDF loaded in WKWebView gets black background around it instead of this light gray.
Now I don't want to implement Dark Theme for my app and stick with Light Theme all the time in Light Mode and Dark Mode. But this black background doesn't look good.
I also have no idea hot to change this, as this seems to be internal WKWebView implementation
[
[
Try to use UIUserInterfaceStyle flag with Light value in app's .plist file to avoid automatically changing colors in a whole app. If you want to do it for certain UIViewController or UIView - just override overrideUserInterfaceStyle property with UIUserInterfaceStyleLight or UIUserInterfaceStyleDark value.

Safe to change the status bar color to black?

Currently, my status bar color is white. I want to make it black because my app would look better that way. My question is, is it "safe" to do so, or does it go against Apple guidelines? Would my app not be approved?
You are allowed to use either of color statusbar in iOS.
From Apple doc.s
The visual style of the status bar’s text and indicators is either
light or dark, and can be set globally for your app or individually
for different screens. A dark status bar works well above
light-colored content and a light status bar works well above
dark-colored content.

Application NightTime Mode

I have just finished creating my first application and would like to add some additional customisations to it. That is, in my settingsViewController I have added a switch which allows to set the colours to a nighttime mode. My questions is how can I actually get my application to do this.
Thanks in advance for your responses.
You can't expect this thing to be handled by iOS itself because its an app feature that you will have to implement.
You can change background colors to dark and all those UILabel UIButton UITextView dark colored as well to have a feature called dark mode(Dark theme) upon user selection.

How to set dark background for iOS10 today widget

I'm trying to workout how to set the background of an iOS 10 today extension/widget to what looks like a default dark mode. In the image below you can see the Weather Underground today widget and it is dark. There are a few apps with a dark background and they all look like the same background/style so I'm thinking it maybe a specific dark mode that can be set in code rather than just fiddling with the view controller color/transparency - no matter how much I try to set the color and transparency manually in the story board I can't even get close to this effect.
You can't do this. The apps that look like this, are not updated for iOS 10 yet. You can see that it hasn't been updated, because it is expanded without showing the "Show less"/"Show more" button.

Tinting the Keyboard InputAccessoryView of a UIWebView

I've got a UIWebView in the app I'm currently working on. It looks fine on iOS7 but in iOS6, I'm getting an ugly tint on the in-built inputAccessoryView when the user gives a textfield focus... Show this screenshot
Is anyone aware of where I can set the tint here? The UIWebView in Interface Builder does give me a tint option but it doesn't seem to do anything. Any insight as to how iOS decides upon the tint color to use here would be interesting too.

Resources