Resolve Custom Tableviewcell Display confusion problems
If we want to solve this problem, we need to use the Prepareforreuse method of UITableViewCell.
Cell is reused how to know in advance? The Prepareforreuse official header file that rewrites the cell is described in. If the currently allocated cell is reused (usually scrolled out of the screen), the cell's Prepareforreuse notification cell is called. Note that when this method is overridden, Note Be sure to call the parent class method [Super Prepareforreuse]. This is especially important when using the cell as a proxy container for network access, where you need to be notified to cancel the previous network request. Don't send data to this cell again.
// if the cell is reusable (has a reuse identifier), this is called just before the cell is returned from the table view method dequeueReusableCellWithIdentifier:. If you override, you MUST call super.- (void)prepareForReuse{ [super prepareForReuse];}
There are many ways to customize UITableViewCell. Some people will encounter the problem of image confusion in their defined cell, which is often caused by the lack of implementation of the Prepareforreuse method.
UITableViewCell is reused when scrolling down, the cell that is used is the one that slides out, and the information displayed in the slide-out cell appears here the solution is to implement the Perpareforreuse method in the UITableViewCell subclass, Clear out the contents.
IOS Miscellaneous Pen-How to solve TableView display disorder problem