Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a UITableView with Taller Cells on the iPhone

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

like image 875
Tim Avatar asked Dec 23 '22 13:12

Tim


1 Answers

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.

like image 81
jpm Avatar answered Feb 04 '23 15:02

jpm