views:

47

answers:

2

Hello,

I've got a Table view and it's the child of the View ( see the IB hierarchy ) :

alt text

I want to start customizing the tableCells, so I assume I'll have to add a tableViewController . Where would I start in this instance ? the TableViewcontroller can't be a child of the MainViewController, can it ?

Cheers,

+1  A: 

It would be easier to build a tableViewController class with a table inside that and add the tableViewController to the view instead of reverse-engineering it. The tableViewController will have all your delegate and datasource functions for your table fairly mapped out so you can move whatever you already have into those functions.

As for custom tableViewCells, here's a great tutorial from pragmaticstudio.com on how to do so. He walks you through all the aspects of building a tableViewController and also how to customize your cells in IB.

Kennzo
cool, thanks for that .
Julz
+1  A: 

You would need to add a table view controller at the top level. Then drag connections from the table to the controller of datasource and delegate Then drag connections from the controller to the view for "view" Then change the class of the controller you added (it's the last tab in the inspector) to your custom UITableViewController class (if you don't subclass it it does nothing)

Then make sure that you somehow retain the controller when the nib is loaded. Easiest way is with an IBOutlet in the file's owner.

Sorry if this is a bit general, but the specifics would consume pages. I don't recommend this approach unless you have some experience with this and know what most of the above means, in which case it's possible and sometimes desirable to do this, and good job if you do.

The easiest method, if you just want a simple table view, no special circumstances, is to use the File>New File>UITableViewController with xib for user interface, then go from there with the file it makes, but that isn't your question, so I have answered as best I can.

Alex Gosselin
hey Thanks for that, it does help quite a bit !
Julz
worked like a charm ...
Julz
Solid, nibs aren't so bad once you understand them.
Alex Gosselin