tableView cell height… how to customize it?

后端 未结 4 791
一向
一向 2020-12-09 10:35

Is it possible to modify height of only one cell in a grouped table view?
I have a table view with 2 sections of 3 and 2 rows... I would change row height of the second

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-09 10:49

    You can look at this method:

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

    In your case, the code should look like:

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    {
       if (indexPath.section == 1 && indexPath.row == 1) {
          return SPECIAL_HEIGHT;
       }
       return NORMAL_HEIGHT;
    }
    

    You can look for more details about the method here

提交回复
热议问题