简体   繁体   中英

How to return custom cell height from storyboard?

Earlier I asked a question on how to hide a static cell .

The Best answer I got hides the cell as I wanted but then it sets other cell height to 44 .

I would like to find a way to return the height provided by the story board since different cell could have different height.

also my table view is grouped, static , and many sections if that helps make it clearer.

I tried this

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    if (indexPath.row == 5 && image==nil && [indexPath section] == 1){
        NSLog(@"hide cvell");
        return 0;
    }
    return tableView.rowHeight;
}

it seems like return tableView.rowHeight; would return 44 also , so no changes :(


to make it short, here is what I need help with;

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    if (indexPath.row == 5 && image==nil && [indexPath section] == 1){
        NSLog(@"hide cvell");
        return 0;
    }
    return WhatEverSizeFromStoryboard;
}

如果它是一个静态单元格,你应该能够使用超类的实现来获得它:

return [super tableView:tableView heightForRowAtIndexPath:indexPath];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM