Safe to change the status bar color to black? - ios

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.

Related

Main.storyboard is pitch black

I've been coding in Xcode for a long time but I've never used the storyboard. When I opened it up I got this pitch-black.
Does any one know how to fix this ?
A lot can cause a black screen. I think, most likely, you are currently previewing dark mode. You can switch back to light mode by clicking View as and changing the appearance.
Or, the background color of the view might be set to black (probably not the case though). You can change this in the attributes inspector.
Black color
System background color
System Background Color is white in light mode, and black in dark mode.
And there's always the possibility that Xcode is glitching. In that case, quit and relaunch.
For me, I had a datepicker set to inline mode, and it messed things up. I'd try and recall if you did anything that Xcode didn't like before it went black, and try and reverse that.

How To Avoid iOS Blue Location NavigationBar Messing Up My StatusBar?

iOS has a feature that (I'm using both iOS 10 and 11) when you use a location-based app, say Waze, and you put that app on the background, there will be a blue navigation bar with a blue status bar background saying that Waze is currently using your location. Then open up your own project and close the Waze, this will happen.
Any idea how to fix this one? I'm guessing some configuration in the AppDelegate. Something to setup upon making your project active. I've tried the same steps in my other project and I have no idea why does that other project handle it a little better. The other project has a readable status bar but different background color, still quite a mess but better than in this project in the photo.
This is how your app should work:
The status bar is transparent.
Your view controller's main view should underlap the status bar; it should be fullscreen.
Your views should use autolayout to respond to changes in the size of the top bars (they should be pinned to the top layout guide or, in iOS 11, the top of the safe area).
You are not doing that correctly, so your app does not behave correctly when the status bar size changes due to the location manager bar. You probably have the same problem with phone calls coming in. You can easily test in the Simulator by choosing Toggle In-Call Status Bar.

iOS UIAlertController Dark Theme

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.

SKStoreProductViewController buttons displaying in White color

I am using SKStoreProductViewController in my app.Some times buttons are showing in white colour. how to change button colour to default colour.
Since SKStoreProductViewController is an OS view controller, it should have consistent presentation every time you open it (that's the case from my experience), unless if maybe you are open it from different OS versions.
Please describe what do you mean in "sometimes" - what are you doing different?

iOS7 - Status bar with specific color

is it possible to change status bar text and battery icon to specific color, for example red color?
I have read some article about this, suggesting me to use setStatusBarStyle. But I don't have option to set to specific color.
So, is it possible to do this? Thanks in advance
EDIT :
I was trying to find the answer at apple dev forum, but unfortunately I can't find it. The available color for UIStatusBar in iOS7 is black and white.
Maybe you can try Sulthan's post below, but seems not easy, at least for me. Seems need so much effort for just simple color changing. So I don't think this is possible, at least in easy way.
Anyway, thanks for helping me :)
Warning - in general, changing the color will not be received well by App Store reviewers.
You can hide the default status bar and add your own. This would require displaying time, battery information, network state etc. It's not an impossible solution, not hard to implement but it will take time and it won't look exactly like the native status bar on all the devices.
You can show a partially transparent view over the white status bar and change the color this way. However, it will also change the color of the status bar background.
You can use undocumented API. Status bar is a system window (not returned by [UIApplication windows]) but there are ways to gain access to it (see, for example, Window Registry to gain access to all application windows). Then you can use reflection (obj.c runtime) to check which methods are available on the status bar and try to change the colors (see UIStatusBar and UIStatusBarWindow) It also might be possible to draw the native status bar into an image, replace white pixels with colored pixels and then draw the resulting image over the original status bar.

Resources