Setting navigationBar to clear

Asked by At

I'm trying to set the Navigation Controller Navigation Bar to clear / opacity 0

I seem to have it somewhat working, when I run my code in the simulator the white background bar is there however if I navigate to my other page then back it disappears.

My code is the same as the answer in this question, yes but my issue is that the Nav Colour only works once I've navigated away from the first screen and gone back to it. It's not that it doesn't work completely.

import UIKit

class LoginMenuViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
        self.navigationController?.navigationBar.shadowImage = UIImage()
        self.navigationController?.navigationBar.isTranslucent = true

    }    

}

0 Answers