Just a short conceptual question: I am making an ap that has a tabviewcontroller on root level. Every tab contains a table with 2 drill down levels and at the end one detail view.
What is the approach ? I think a TabBarController that Contains NavigationControllers that contain TableViewControllers ? Is that right ? So far so good. But i am not quite sure what the appropriate way is to create t开发者_JS百科hose NavigationViewcontrollers. Should I create them with IB and then use "Write class Files" to get the .m and .h ? or is there a more straight foreward way ? tia Heiko
Here's the basic setup in IB:
In IB, drag two Navigation Controllers out of your library and drop them on your Tab Bar Controller so that they appear to be nested underneath it.
Now drag two Table View Controllers out of your library and drop one onto each of your two Navigation Controllers.
In code, create two UITableViewController subclasses to populate your top-level tables.
Back in IB, select your first Table View Controller, bring up the inspector, go to the "Identity" tab, and change the Class field to the name of your first UITableViewController subclass. Change the class of the second Table View Controller in the same way to match your second UITableViewController subclass.
You now have a basic setup that will give you a Tab Bar Controller with two Navigation Controllers, which have their root View Controllers set to your two custom UITableViewController subclasses.
When users drill down in tableView:cellForRowAtIndexPath:
, you can construct your lower level view controllers in code and navigate to them using [self.navigationController pushViewController:yourDrillDownViewController animated:YES];
I had a similar challenge and found this excellent video on doing it. A quick google search will also produce some useful tutorials.
精彩评论