I just want to add a tableview to the key window,but i can't see the navigationItem. How can i make it appear. I know I can push it to a navigationController, but in here I want add it to the window. So, how can i do that?

有帮助吗?

解决方案

A view controller's navigationItem only appears if the view controller is put into a navigation controller. It is the navigation controller that displays a view controller's navigation item. If you want the view controller's navigation item displayed (in a navigation bar), then create a UINavigationController passing in your UITableViewController as its root view controller. Then make the navigation controller the window's root view controller. You will now have a navigation bar at the top showing the table view controller's navigation item and the table view filling the rest of the screen.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top