I have a View Controller which is already embedded in a Navigation Controller as such:
The Table View Controller has a programatically added title and button which work fine:
override func viewWillAppear(_ animated: Bool) {
navigationItem.title = "The Harrovian"
}
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .refresh, target: self, action: #selector(refresh))
I wanted to embed the Table View Controller in a Tab View Controller as such:
Now, however, the title and button of the table view have disappeared. Why? How can I fix it?
You are creating the architecture of the wrong app, I would first start by creating the application with the NavBarController, I would use a navigation controller for the rest of the screens, so the navigation does not conflict.
The problem you're presenting is a conflict between the two controllers
I know this does not respond to your question entirely, but from what I know, the practice is to first embed the tab bar controller, and then the navigation controller for each tab. That is because every tab is a different view, and you you cannot assign the same navigation to two tabs.
If that would be possible, when you would use the navigation on tab 1, you access the view that is separate from tab 2, and when you switch to tab 2, the same navigation does not apply to the view in tab 2.