views:

672

answers:

1

I am writing an iPhone app. According to the design, it is supposed to contain a lot of grouped table views. In these views, the rows are frequently not similar to each other. For example, on one screen, one row is the name of a task, another is its owner, another is its description, yet another is its history (which is supposed to be an expanding box), and so on. These rows are edited in different ways. For example, the name can be entered free-form, but the owner has to be chosen from a list, which would be brought up in a further table view.

I think doing all of this programatically would drive me batty. What I want is a way to design these screens in IB. But I can't figure out how to get IB to do treat the cells individually. Is that possible?

Thanks.

+1  A: 

In Interface Builder you create custom UITableViewCells for each row and then return the appropriate custom cell in – tableView:willDisplayCell:forRowAtIndexPath:. You also need to return the height of each custom cell in – tableView:heightForRowAtIndexPath:.

Within Interface Builder, you create a custom cell just like you would any view. You size the cell and then fill it with subviews. It's best if you create a UITableViewCells subclass for each custom cell that has IBOutlets that connect to each subview. That way you can easily access labels, imageviews, controls etc.

TechZen