07-19-2023, 12:10 AM
**Problem:**
I have a `UITableViewController` embedded in a `UINavigationController`. Pressing a cell in the table view switches to another table view controller. In said table view controller, I'd like for the navigation bar to be invisible while still keeping the tab bar items so I added the following to its `viewDidLoad()`:
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.navigationBar.tintColor = .black
For the first UITableViewController, I'd like the navigation bar to be normal so in its `viewDidAppear()` I did the following:
self.navigationController?.navigationBar.isTranslucent = false
Everything is working fine except during the transition (which I am doing via `performSegueWithIdentifier`) the navigation bar on the first view controller disappears into blackness which looks ugly to be honest. Is there any way to prevent/fix this?
**Screenshot:**
![enter image description here][1]
[1]:
I have a `UITableViewController` embedded in a `UINavigationController`. Pressing a cell in the table view switches to another table view controller. In said table view controller, I'd like for the navigation bar to be invisible while still keeping the tab bar items so I added the following to its `viewDidLoad()`:
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.navigationBar.tintColor = .black
For the first UITableViewController, I'd like the navigation bar to be normal so in its `viewDidAppear()` I did the following:
self.navigationController?.navigationBar.isTranslucent = false
Everything is working fine except during the transition (which I am doing via `performSegueWithIdentifier`) the navigation bar on the first view controller disappears into blackness which looks ugly to be honest. Is there any way to prevent/fix this?
**Screenshot:**
![enter image description here][1]
[1]: