Custom Cell Row Height setting in storyboard is not responding

后端 未结 18 2126
名媛妹妹
名媛妹妹 2020-11-30 16:54

I am trying to adjust the cell height for one of the cells on my table view. I am adjusting the size from the \"row height\" setting inside the \"size inspector\" of the cel

18条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 17:17

    If you use UITableViewController, implement this method:

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

    In the function of a row you can choose Height. For example,

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        if (indexPath.row == 0) {
           return 100;
        } 
        else {
           return 60;
        }
    }
    

    In this exemple, the first row height is 100 pixels, and the others are 60 pixels.

    I hope this one can help you.

提交回复
热议问题