TableView refresh and tableView refresh
First
I believe everyone can see the "store discount" column. Here we assume that this column is a separate cell, when there is no store discount, you cannot click it. The discount list will pop up when there is a store discount, and the data will be refreshed when you select and return, so the pop-up view uses the lazy loading method, in addition, the page is refreshed by reloadRowsAtIndexPaths: withRowAnimation instead of tableView reloadData:
However, I was shocked by the fact that the selected data in the previously selected discount list had changed when there were store discounts that were repeatedly clicked in the pop-up box, as a result, the returned data is constantly changing. This was a pleasant choice, but such unpredictable thing happened. The problem was not found after thinking about it, finally, I had to try to find the problem in this refresh method.
I did not expect that I had created two la s when loading the pop-up box view, not many, but twice. So I was thinking that there must be something wrong with reuse, but after reading the code, I didn't feel any problem, but I also habitually set a breakpoint to see how it went. However, the development of things exceeds the expected result, when the cell has already been created, a new cell was created during the refresh process, so I tried to replace the reloadData method with reloadData, so this time there is no problem, finally, we confirmed the reloadRowsAtIndexPaths: withRowAnimation: the ghost.
After reading the information, I learned that reloadRowsAtIndexPaths: withRowAnimation: the cell enters and removes the animation when refreshing. Therefore, at least two available cells (including cells in the multiplexing pool) are required at the same time ), reloadData first places all cells in the reuse pool, and then obtains reusable cells from the reuse pool.
The truth is that
Author: Chu Guangfu