No index path for table cell being reused

前端 未结 13 1506
执念已碎
执念已碎 2021-02-04 05:18

This started to happen out of the blue. Any ideas: Code:

CUSTOMCLASSNAME (I have replaced the actual class name as it contains the name of the client.)

Initialis

13条回答
  •  太阳男子
    2021-02-04 06:16

    If you are using the cell for the header view section header, you have to put it into the container and then return the container view to prevent "no index path for table cell being reused". The sample code as below.

    -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
        CustomerCellHeader *headerViewCell = [tableView dequeueReusableCellWithIdentifier:kCustomerCellHeaderIdentifier];
        headerView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        [headerView addSubview:headerViewCell];
        return headerView;
    }
    

提交回复
热议问题