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")
}
Related
I have read the other posts about the UINavigationBar's Prompt not following the color values of the actual Title. Most of the posts are from the iOS 11 era, and the solutions no longer work on iOS 13.
These are examples of previous posts that no longer have working solutions:
Can't change UINavigationBar prompt color
Change font of prompt in UINavigationController
iPhone: Possible to change the color of just the prompt of the UINavigationBar?
Has anyone else encountered this?
I would suggest the following:
Check that the device is not running in Dark Mode.
Verify that the background-color was not modified anywhere in the code.
Make sure that the style is set to default like in the screenshot below:
I've received a screenshot from my app by an older lady who seems to have activated "Bold text" in her iPhone settings.
Since I've never really looked at that before and my app does not support dynamic text (which seems to not be related) I was surprised to see that in this mode the tint colors I gave my bar button items are being ignored and they'll always show in standard iOS Nav bar button blue, this line of code does not have an effect anymore:
myBarButtonItem.tintColor = myColor
In my case the color indicates their state so that's a dealbreaker.
I know that I could detect whether the user has activated this setting (as indicated in the answer here Possible to detect Bold Text setting in Settings > Accessibility? ) and indicate the state by using different icons...
But is there any way around this and keep my tint colors in bold text mode?
Try with appearance
UIBarButtonItem.appearance().tintColor = yourcolor
I've been trying to remove the top border (shadow) line from Tab Bar in Swift 4 for > iOS 10. I'm also using a custom background image. I've just given up after searching for solutions, since none of them work.
The solution which came closest was this post.
The solution given everywhere works if there is no background or for < iOS 10. For iOS > 10 and using a custom background image none of solutions work.
I even tried using a transparent shadow image, but it required setting cliptobounds to true which doesn't show custom background image.
So at the end of all these solution I'm stuck. Couldn't find any working solution.
I'm setting these custom values in AppDelegate so that it works for all Tab Bars.
I just created a sample project using tab bar template from Xcode and write three lines of code
self.tabBar.layer.borderWidth = 0
self.tabBar.clipsToBounds = true
self.tabBar.backgroundColor = .blue
And tab bar top border is no longer visible. I've tested this on Simulator iphone 6 with ios 11.2
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.
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.