views:

208

answers:

1

I'ld like to create a Navigation controller programatically from a Nib file, and add to that a table view controller (as its root controller). The table view controller needs to be initialised with a data set that can be changed.

This is so I can reuse the table view controller in different two places (one from a list showing all data and another from a search showing a subselection). The table view controller needs to have certain properties set that controls the data it displays.

So, a high level view of my application looks like this

                  TabBarController 
                   /           \  
NavigationController1          NavigationController2
       |                                 |
TableViewController (all data)        SearchController
        |                                     |
    DrillDown                        TableViewController (search results)
                                              |
                                          DrillDown

The table view controllers on either side are exactly the same except for the data it displays.

Currently the TabBarController is in the main nib file. NavigationController2 is set in the nib file, while NavigationController1 is created from a different nib file and added to the TabBarController in code (so I can set the data it displays). NavigationController1 then adds TableViewController programatically. SearchController programatically loads TableViewController on a button action with data narrowed to provide search results.

Which functions (and where) do I use to setup everything and how do I set the underlying data of the table view controller?

A: 

I solved the problem by creating NavigationController1 programmatically rather than from a NIB.

RaelG