Why do my table view cells disappear when reloaded using reloadRowsAtIndexPaths?

后端 未结 12 1962
青春惊慌失措
青春惊慌失措 2021-02-02 12:20

I have a bare-bones sample project here:

http://dl.dropbox.com/u/7834263/ExpandingCells.zip

In this project, a UITableView has a custom UITableViewCell. In each

12条回答
  •  半阙折子戏
    2021-02-02 12:37

    This problem is caused by returning cached cells in cellForRowAtIndexPath. The reloadRowsAtIndexPaths is expecting to get fresh new cells from cellForRowAtIndexPath. If you do that you will be ok ... no workarounds required.

    From Apple doc: "Reloading a row causes the table view to ask its data source for a new cell for that row."

提交回复
热议问题