Josh Kahane Josh Kahane - 1 year ago 102
Objective-C Question

Set Height Programmatically for a Single UITableViewCell?

I need to set the height for a single UITableViewCell in my UITableView programmatically. How can I do this?

I need this one cell to be 150 pixels high and all the others can stay at their default 44 pixels in height.


Max Max
Answer Source

There is a delegate function for the UITableViewCell height.

Here you specify the indexPath of that particular cell and return your height for it

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if(indexPath.section == yourSection && indexPath.row == yourRow) {
        return 150.0;
    // "Else"
    return someDefaultHeight;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download