why my navigation bar is completely white in iOS 13? - ios

I want to make my large title navigation bar to be back to the default nav bar like the image above, the image above is when I run the app on iOS 12, there is a separator line and the color is little bit grey.
but when I run the app in iOS 13 is like the image below, the navigation bar is completely white and it seems there is no dark grey separator
I want to make my nav bar in iOS 13 is exactly the same as iOS 12, which is little grey and it has separator line
and here is the code I run in viewWillAppear :
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.largeTitleDisplayMode = .always
}
I am using storyboard, and here is the setting I use. even from storyboard, as you can see, it seems the nav bar is already completely white and no separator

The behavior you are seeing is normal and correct in iOS 13. In iOS 13, a navigation bar with a large title is, by default, transparent. That means the white of the main view behind it shows through and it has no shadow (what you call the "separator"). You surely must have noticed this by now on your phone; iOS 13 has been around for almost a year! Apple's own apps generally look this way.
If that isn't what you want, configure the navigation bar's scrollEdgeAppearance to be what you do want.

Related

Tab Bar color different on iOS 14 and iOS 15

I'm using the newest version of Xcode.
My iOS app is build with a Tab Bar Controller. The main Views of the View Controllers that are connected to the Tab Bar Controller have a green Background color. This will make the menu bar at the top (with time, network …) green and will make the Tab Bar have a slight green touch, on iOS 14, like this:
But since iOS 15 the Tab Bar is fully green instead of translucent with a green touch. It looks like this:
Why that? How can I have the same effect on iOS 15 as on iOS 14.
Swift:
UserDefaults.standard.set(false, forKey: "UIBarsApplyChromelessEverywhere")
Objective-C:
[NSUserDefaults.standardUserDefaults setBool:NO forKey:#"UIBarsApplyChromelessEverywhere"];
This will also fix UINavigationBar and UIToolbar.

How to completely hide title bar but not navigation bar in iOS 13 Swift

I have a problem with my app development in Xcode 11.3. I'm developing an app targeting iOS 13.2, and I've edited the navigation bar so that its background is black. However, I can't seem to find a way to delete or hide the title bar. Now it just looks like a big black bar.
All the other content is served over a webview, so that's why I'd need to remove the title bar but not the black background color in the navigation bar (where the time and battery, etc. are displayed). I hope you can help.
Here's the preview currently:
Thanks!
So it sounds like you want something like this:
So, in that screen shot:
We're in a navigation interface, but the navigation bar is hidden.
The green view is a stand-in for your "Aleksis" view. Its top is pinned to the bottom of the safe area.
There is also a black view. Its top is pinned to the top of its superview (the view controller's main view) and its bottom is pinned to the bottom of the safe area. It is behind the green view.
Here's the storyboard configuration I used:
Here's the view controller code:
override var preferredStatusBarStyle: UIStatusBarStyle { .lightContent }
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.isNavigationBarHidden = true
}

iOS top bar not showing

I am trying to show a top bar in Xcode 9 Swift 4. In my storyboard it shows the top bar as in the below picture:
but when I run it I get this with no top bar:
I tried to use a navigation bar just with a title but it shows as:
the carrier, wifi, time, and battery background is still white. If I set the navigation bar to the top of the screen, it will cover them like:
Why the top bar is not showing? How can achieve something like this?:
UPDATE
Top bar is not a navigation bar. It is kind of just a bar that shows a title. As you can see in the below picture, the register scene doesn't have a navigation bar. I added the top bar from the properties on the right side.
In your second to last screen, where you show that the navigation bar covers it:
It does not really cover it - but the text of the status bar is black, so you cannot see it. To change it, in the implementation of the GrolocationNewsViewController (or whatever you call it) override preferredStatusBarStyle and return .lightContent:
class GrolocationNewsViewController: UIViewController {
// rest of the code
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
}
I have used the code from #Milan Nosáľ answer and it does show the status in white. Then used #Ameya Vichare answer on this link while I was looking for a way to increase the navigation bar height
How to change navigationBar height in iOS 11? turn out it is a bug in Xcode 9. Now it shows like what I wanted:

Blurred translucent navigation bar in iOS

I'm trying to get this blur-translucent navigation bar effect (The first navigation bar in the image) in my Swift iOS application:
But I can't get this done. I've tried several methods, some of them are below:
setBackgroundImage, shadowImage and translucent attrs in AppDelegate (Getting the NavController from the RootViewController attr)
Those lines in AppDelegate main method:
UINavigationBar.appearance().translucent = true;
UINavigationBar.appearance().barTintColor = UIColor(white: 1, alpha: 0.4)
Changing attributes from UIBuilder
Setting self.automaticallyAdjustsScrollViewInsets = true and self.edgesForExtendedLayout = UIRectEdge.None in viewControllers
But still can't get this to work. I'm running the app on XCode simulators, using iOS 8.1 and 9.0
What I am doing wrong?
The second navigation bar is already translucent and blurred—it just isn't quite as translucent as the first navigation bar. If you open Digital Color Meter and mouse over your screenshot, you can see that the background of the second navigation bar is darker in the area covering the image.
The reason why the first navigation bar is more translucent than the second navigation bar was explained in this question: the screenshot of the first bar was taken from a device running iOS 7.0.2, whereas the screenshot of the second bar was taken from a device running iOS 7.0.4. Apple changed the behaviour of UINavigationBar between those versions of iOS, and again with iOS 7.1.
Apple explains the current translucency mechanism as follows:
A translucent bar mixes its barTintColor with gray before combining it with a system-defined alpha value to produce the final background color that is used to composite the bar with the content it overlies.
The only description of the blur effect appears to be the following:
Navigation bars are translucent by default in iOS 7. Additionally, there is a system blur applied to all navigation bars.
You can change the transparency of the bar by using UIImage.imageWithColor: to make a background image for the bar from a UIColor with an appropriate alpha value, but doing so will remove the blur effect. There is no documented way to alter the "system-defined alpha value" to increase the translucency of the bar without removing the "system blur".
If you want to imitate the old translucency and blurring effects on iOS 8.1 and 9.0, you'll need to make your own subclass of UINavigationBar and insert one or more subviews such as a UIView with a background color that uses an appropriate alpha value (for transparency) and/or a UIVisualEffectView (for the blur effect).
You might be able to find a combined view in one of the answers to this question.
Related: Blurring effect disappeared on iOS 7.1
Add bellow code in didFinishLaunchingWithOptions:
For Objective C
[[UINavigationBar appearance] setTranslucent:NO];
For Swift 3+/iOS 10+
UINavigationBar.appearance().isTranslucent = false
Maybe plist changes can fix your problem.

How to remove empty gap in navigation bar

In iOS 7.1, there's empty gap on the left and right navigation bar.
In iOS 8.4 it displayed correctly without any gap.
How to fix this in iOS 7.1?
It's in UITableViewController
I don't use storyboard
Code:
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.titleView = UISearchBar()
}
I'm going to ignore the childish back-and-forth in the comments. What you're seeing is the default dimensions of the search bar. What you should be doing is setting the search bar's frame to be equal to the navigation bar's, but you have to beware of two things: not to include the status bar's dimensions, which get tacked onto the nav bar when the view is displayed, and to handle resizing gracefully, because nav bars (obviously) have different sizes in portrait or landscape mode.
Despite all this, let me just say that putting a search bar in the nav bar is a colossally bad UI decision, and it violates Apple's Human Interface Guidelines.

Resources