Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top