views:

714

answers:

3

I was wondering how do people fill a tableview like the one in Safari's preferences, in the iPhone simulator.

I guess I have a tableview controller and then I add controls programmatically? (one by one!?) Is there any trick I'm missing? If I use a resource list or an array, could I get the same result? I mean, with a complex setup, nice icons, labels etc...

THanks!

A: 

Your tableview datasource needs to implement cellForRowAtIndexPath, such that it provides the appropriate type of cell for whatever row needs displaying. You can create cells that contain other controls. You can create the prototype cell in InterfaceBuilder, but so far, I've always done it programmatically.

Mark Bessey
+1  A: 

Safari's iPhone preferences is a grouped table view with multiple custom table cell classes-- it looks like at least three different types. Some of them might just be standard cells with text and an accessory view. You create custom table cells by subclassing UITableViewCell. In your implementation of –tableView:cellForRowAtIndexPath:, return the appropriate type of cell for the section and row.

Tom Harrington
A: 

you should look at the UICatalouge sample of the apple.

Rahul Vyas