First of all, the cells of the system tableView have a reuse mechanism. If you write it according to the standard routine, you will not initialize 10,000 cells at once. If the cells all have the same layout, etc., but the content is inconsistent, it will only be displayed on your screen. These cells in the range
The server side needs to be modified, and each request loads about 30-40 pieces of data. In the front-end tableview, several pieces of data are loaded at a time through drop-down loading.
Look at questions 19 and 20: http://www.henishuo.com/ios-interview-middle-two/
It is definitely not possible to have so many pieces of data at one time. Because tableview inherits from scrollview, and this needs to be calculated to get the contentssize, so how many pieces of data are used as data sources, how many times will the row height be calculated, and then it will be very stuck, or it will take a long time to wait for the first time. .
Recommendation: Only load a small amount of data for the first time, such as 10 or 20 items. Then cache the height, so even if there are 10,000 items, after the height has been cached, there will be no stuck (except for those with a lot of rich text).
Let’s take a look at how to automatically calculate and cache row height in the article!
First of all, the cells of the system tableView have a reuse mechanism. If you write it according to the standard routine, you will not initialize 10,000 cells at once. If the cells all have the same layout, etc., but the content is inconsistent, it will only be displayed on your screen. These cells in the range
You can try using local data
The server side needs to be modified, and each request loads about 30-40 pieces of data.
In the front-end tableview, several pieces of data are loaded at a time through drop-down loading.
Look at questions 19 and 20: http://www.henishuo.com/ios-interview-middle-two/
It is definitely not possible to have so many pieces of data at one time. Because tableview inherits from scrollview, and this needs to be calculated to get the contentssize, so how many pieces of data are used as data sources, how many times will the row height be calculated, and then it will be very stuck, or it will take a long time to wait for the first time. .
Recommendation: Only load a small amount of data for the first time, such as 10 or 20 items. Then cache the height, so even if there are 10,000 items, after the height has been cached, there will be no stuck (except for those with a lot of rich text).
Let’s take a look at how to automatically calculate and cache row height in the article!
According to the reuse mechanism of tableviewcell, this seems not to be considered? Run it and try how much memory it occupies...
There is no need to consider this issue under the cell reuse mechanism