views:

1687

answers:

2

How can I go about creating a UITableView with taller cells? Basically, I want to create a full screen table with only four cells, but they should take up the entire screen (1/4 each).

Assuming this is possible using a UITableView, can it be done both in code and in Interface Builder? And also, can each cell have its own height?

--Tim

+4  A: 

Just use the -tableView:heightForRowAtIndexPath: method from the UITableViewDelegate protocol to customize the height of each cell. Something like this works just fine:

- (CGFloat)tableView:(UITableView *)tv heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 70.0f;
}

Hope that helps.

jpm
+4  A: 

For best performance, if all your rows are the same height, use the rowHeight property. It's accessible from both code and Interface Builder.

If you want to customise individual row heights, then you need to implement the - tableView:heightForRowAtIndexPath: delegate method. It's a little slower performing, but more flexible.

Mike Abdullah