No index path for table cell being reused

前端 未结 13 1706
执念已碎
执念已碎 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:15

    I had issues with returning a UITableViewCell in tableView:viewForHeaderInSection, but returning [cell contentView] was causing any buttons within the cell to crash, and setting a view wrapper around the cell seemed wasteful. Instead, I changed my UITableViewCell class to a UITableViewHeaderFooterView and it worked like a charm!

    If you get this issue:

    Setting the background color on UITableViewHeaderFooterView has been deprecated. Please use contentView.backgroundColor instead.

    Just remember to change the background color on your nib to default.

提交回复
热议问题