TableView refresh and tableView refresh

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.