Search code examples
iosswiftuitableviewcells

How many table view cells should a table view consist of?


For instance, in the app I'm working on, a user can create a post, and other users are then able to reply to that post. people can then comment the reply. My question is: Would it be better for the memory to split a post with multiple replies and comments into many cells, or keep them in one cell?


Solution

  • With reusable cells or views, UITableview never makes more instances of the visual components than necessary. Your underlying data source may have thousands of rows but there will never be more actual cells than will fit on the screen (plus a few more for scrolling).

    One of the most common issues people come across with this is the effect of cell recycling as they often forget to initialize all components of a cell (that may or may not be "recycled").