Embed Material CardTableView in UINavigationController

121 Views Asked by At

I am trying to setup a master/detail view with CardTableView as my root and am having trouble implementing

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 
    //code
}

I want to use a self.navigationController?.pushViewController so that the detail view can easily come back to the table view. However when I try to embed this in a Navigation controller I get a strange looking title bar:

enter image description here

This is my view hierarchy:

let tabs = AppPageTabBarController(viewControllers:[InvitedViewController(), CoordinatingViewController(), PastViewController()])
let toolbar = AppToolbarController(rootViewController: tabs)
let navigationController = UINavigationController(rootViewController:toolbar)
let fabController = AppFABController(rootViewController: navigationController)
let snackBarController = AppSnackbarController(rootViewController:fabController)
let navDrawer = MyTeeUpsViewController(rootViewController: snackBarController, leftViewController: NavDrawerContainerController())
self.present(navDrawer, animated: true)

Wondering if there are any alternatives to this approach

1

There are 1 best solutions below

0
On

By default, UINavigationController shows its own navigation bar above your view controller(s). In your screenshot, it's the large, light-colored bar above your views. If you don't want this, you'll have to set it so when you instantiate the navigation controller:

// You may want to animate it if you hide/show it after it's onscreen
navigationController.setNavigationBarHidden(true, animated: false)