0

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?

muratgu
  • 7,241
  • 3
  • 24
  • 26
NewXcoder
  • 705
  • 1
  • 5
  • 18

1 Answers1

-3

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.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • I think you is right.But if it put into a navigation controller, how can i dismiss it. – NewXcoder Oct 13 '12 at 01:46
  • Can I use "self.navigationController.view removeFromSuperview" in a button's action? I think it is a bit strange to operate it's superview, or it's just fine when is in navigationController? – NewXcoder Oct 13 '12 at 01:55
  • My english is not good, I hope you can understand me! – NewXcoder Oct 13 '12 at 01:56
  • Since your question was closed, you should post another question if needed. – rmaddy Oct 13 '12 at 02:31