I'm creating an app and i've browsed on the internet and i'm wondering how they make this transparent navigationBar like this:
I've added following like in my appdelegate:
UINavigationBar.appearance().translucent = true
but this just makes it look like following:
How can i make the navigationBar transparent like first image
If you want to be able to do this programmatically in swift 4 while staying on the same view,
One important thing to remember though is to click this button in your storyboard. I had an issue with a jumping display for a long time. Make sureyou set this:
Then when you change the translucency of the navigation bar it will not cause the views to jump as the views extend all the way to the top, regardless of the visiblity of the navigation bar.
Swift 3 : extension for Transparent Navigation Bar
What it worked for me:
I was able to accomplish this in swift this way:
where i created the following utility method in a
UIColor
category:Swift Solution
This is the best way that I've found. You can just paste it into your appDelegate's
didFinishLaunchingWithOptions
method:Swift 3 / 4
Swift 2.0
source: Make navigation bar transparent regarding below image in iOS 8.1
Set the background property of your navigationBar, e.g.
(You may have to change that a bit if you don't have a navigation controller, but that should give you an idea of what to do.)
Also make sure that the view below actually extends under the bar.