Make navigation bar transparent regarding below image in iOS 8.1

Victor Sigler picture Victor Sigler · Dec 30, 2014 · Viewed 16.6k times · Source

I try to set my navigation bar transparent regarding a image below this, something like the following image :

enter image description here

I tried the solution in transparent navigation bar ios but I don't get the above result, I get only the icon on the left but without any color in the navigation bar, completely transparent. But if I set a background color the transparency disappears at all.

There is any way to set a color in the navigation bar and make it transparent??

Thanks in advance.

Answer

sage444 picture sage444 · Jan 5, 2015

just checked on the 8.1 simulator and got very similar result to your picture

    let bar:UINavigationBar! =  self.navigationController?.navigationBar

    bar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
    bar.shadowImage = UIImage()
    bar.backgroundColor = UIColor(red: 0.0, green: 0.3, blue: 0.5, alpha: 0.3)

main point here is background color with alpha.

Check attached image, maybe I missed something?

enter image description here