Setting static cells in uitableview programmatically

后端 未结 5 1467
温柔的废话
温柔的废话 2021-01-02 17:11

I am programmatically creating a tableview in objective c. How can I make the cells static programmatically?

Thanks

5条回答
  •  甜味超标
    2021-01-02 17:25

    You could also do it the old fashioned and just create the cell the way you want depending on the NSIndexPath, this works with Static Cell TVC's and regular table views (don't forget to return the proper number of sections and rows in their datasource methods):

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        switch indexPath.row {
            case 0:
                // First cell, setup the way you want
    
            case 1:
                // Second cell, setup the way you want
        }
    
        // return the customized cell
        return cell;
    }
    

提交回复
热议问题