I've got a little bit of an issue with the status bar for iOS7, iPhone 4 and up.
Since my app's background is dark, I need the status bar to be white, which looks fine.
However, when minimizing the app, waiting a few seconds and going back into the app, it slightly flashes from full white to darker white back to full white within a period of less than half a second.
You can reproduce this by simply creating an empty new XCode project, setting the statusbar to white (see below how I did that), then running the app on simulator or device, minimizing it and maximizing it again.
Things tried:
UIViewController-based appearance with:
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
and
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation {
return UIStatusBarAnimationNone;
}
And view controller-based status bar appearance set to NO in the PLIST, with also:
Transparent black style (alpha of 0.5)
Status bar is initially hidden set to NO in both situations.
Is this something out of my programmatic control?
I had the same issue and solved it by setting on the info.plist file the following values, on iOS 10*:
Status bar style = UIStatusBarStyleLightContent
View controller-based status bar appearance = NO
If you prefer directly in your Info.plist:
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
Related
I noticed that the iOS app, Things, has a status bar with grey content (not black, or white) in their iPhone app. I noticed this on an iPhone X. I was under the impression that you could only have a status bar with black or white content by setting the status bar style.
See the attached screenshot for an example.
How would they have achieved this in their app?
Edit: I do not mean the background color of the status bar, I mean the actual color of the text and icons in the status bar.
Ok, after some more digging I found this comment on StackOverflow.
It does exactly what I was looking for. Looks like it uses some sort of Private API, so probably not the wisest thing to implement in a real app.
Specifically the code that worked for me is found below. Put this code in application(_:didFinishLaunchingWithOptions:) inside your AppDelegate.
Swift 4
if application.responds(to: Selector(("statusBar"))),
let statusBar = application.value(forKey: "statusBar") as? UIView,
statusBar.responds(to: #selector(getter: CATextLayer.foregroundColor)) {
statusBar.setValue(UIColor.gray, forKey: "foregroundColor")
}
I'm a beginner with iOS app development and want to customize the Status Bar colour. I have set my scene to a dark background and I want to battery and time in the Status Bar to match the colour.
At the moment I have added
var navigationBarAppearace = UINavigationBar.appearance()
UIApplication.shared.statusBarStyle = .lightContent
in AppDelegate.swift
Is there a way to add a custom hex colour for the text, not background?
I'm afraid there isn't without accessing private API's, which will get your app declined from apple review.
It's best to just find a way to make your app design work with the given, white or black status bar style.
The one thing you could do is create your own status bar that imitated the UIStatusBar, with your own labels and icons, but that would be a reasonable amount of hassle.
iBooks's status bar
what the picture say, it's my want
How can I set my app's status bar to gray?
I only found the Default and LightContent in the UIStatusBarStyle.
How can iBooks do it?
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
in info.plist
Enabling personal hot spot pushing down the view and related subviews pushing down. How to disable the personal hotspot notification programmatically? (how can i restrict iPhone status bar to original size even when HOT SPOT is on?)
I found rather late that the Personal Hotspot doesn't just add 20points to the status bar, it messes up views that rely on drop points in an animator with gravity. I added code that checks the status bar height before laying out the views. If it's not 20, then it's probably the hotspot, so I just hide the status bar. Not an ideal solution, but works so far.
- (BOOL)prefersStatusBarHidden {
if ([UIApplication sharedApplication].statusBarFrame.size.height == 20) {
NSLog(#"Status bar is 20 so returning NO for hidden");
return NO;
}
NSLog(#"Status bar is not 20 so returning YES for hidden");
return YES;
}
If you disable statusbar then automatically disable Hotspot bar.
The Apple documentation is not very descriptive of the status bar, esp. the 2nd row that appears when you are using hotspot, map, calls, etc.
Even if more than one is running, there is only one additional row.
I don't know how 3rd party apps appear, but the questioner asked specifically about Personal Hotspot which is a system service.
I doubt the display can be controlled by anybody, except when the user turns the service off.
You probably have to do it the "hard" way". You should hide the main status bar, then draw your own custom status bar.
BTW, Apple says not to do this:
Use the system-provided status bar. People expect the status bar to be consistent systemwide. Don’t replace it with a custom status bar.
https://developer.apple.com/ios/human-interface-guidelines/bars/status-bars/
It's an alternative way but it works.
First include a new key in your project's Info.plist:
Status bar is initially hidden: YES
And then, in your AppDelegate, at didFinishLaunchingWithOptions you can set:
[application setStatusBarHidden:NO];
This will hide the hotspot bar during launch screen and then show it again when the app launches.
Is it possible to change the background color of the top bar in iOS 6 with AIR for Mobile or can this only be done in native Objective-C?
What I mean:
http://shurl.be/uLwt
I've found a simple and easy solution for this.
Default the status bar style (UIStatusBarStyle) is set to UIStatusBarStyleBlackOpaque.
Just change the value to UIStatusBarStyleBlackTranslucent and set the background color of the SWF to the color you want the status bar to have.
So what I've done is just this:
Added the settings below in the Application descriptor
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackTranslucent</string>
And changed the SWF background color
[SWF(backgroundColor="#ff6a00")]
Result:
VS
The solution for this in objective-c:
You can change it from, Target Settings -> Summery -> tint of status bar
Or
you can change it back to black from, info.plist -> set value for status bar style as opaque black style.