Search code examples
iosuitableviewnsmutablearraycell

UITableView ( Easy tableView custom class) cell's image (drawings) are persistent after changing data


I am using the Easy Table View class https://github.com/alekseyn/EasyTableView. After I change the data and redraw the cells, it works, but the drawing of the previous data remains in the view (behind the new drawing of the new cells).

I have tried reloading the data after making the data's array nil, but does not clear the old drawings:

[myEasyTableView.tableView reloadData];

Here is a screen shot. This is a horizontal table view, which is easy to set up with this class. The top half of the image is what it should look like, but note after changing the data below, the drawing of the formerly existent cells are still visible, beneath the actual new cells.

enter image description here


Solution

  • I added the following code to the method that sets up the tableView. Seems to do the trick.

       for (CellView* cellView in horizontalTableView.subviews) {
            [cellView removeFromSuperview];
        }