I am inside a UINavigationController. The UINavigationController has 3 view controllers. The first 2 are tableViewControllers, the last one is a regular view controller, with a PageViewController embedded.
I am using the following code in the third view controller in the stack to make the UINavigationBar clear:
navigationController?.navigationBar.shadowImage = UIImage()
navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
I put this code in the third view controller in the stack. That is the view controller with a UIPageViewController embedded. But the nav bar is black. However, when I pop the third controller off the stack and go back to the second, a UITableViewController, the navigation bar there is clear.
I have looked at numerous other questions, here: How to make completely transparent navigation bar in iOS 7 and here: Transparent UINavigationBar in Swift but nothing works.
what am I doing wrong? the 2 lines of code above are the only ones I'm using, but I have also tried the suggestions in the links above, and nothing works. Here is a photo of the black nav bar: