Adding a NavigationBar to UITableViewController programmatically?

Posted by Tony on Stack Overflow See other posts from Stack Overflow or by Tony
Published on 2010-04-23T18:21:27Z Indexed on 2010/04/23 18:23 UTC
Read the original article Hit count: 939

Filed under:
|

I am trying to create a uitableviewcontroller as a modal viewcontroller to edit some settings. I am creating the tableviewcontroller in code and the thing i am struggling with currently is how to correctly add a navigation bar to the controller which will have a "Done" button on it that:

a) doesnt appear on top of the tableview and b) does not scroll with the tableview??

This happens when i add the navbar to the contoller with: [self.view addSubview:navigationBar]; This adds a navbar to the controller which goes on top and obscures the tables first row and also scrolls with the view?

I also thought about simply using a uiviewcontroller with a separate tableview however i like the funcitonality of automatically scrolling the tableview when editing a textfield that the tableviewcontroller gives you. Just cant figure how to setup this navbar??

thx

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c