IOS notes -- traverse tableview

Source: Internet
Author: User

IOS does not advocate traversing all cells. It can be seen from the APIS thrown to developers. It provides a visiblecells method, so that you do not have to easily obtain all cells and optimize the memory usage.

What should I do if I have to traverse all cells?

// Only visible cells are returned.
- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath
 
// Only the invisible cell is returned.
- (UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier

If the two methods are used together, it will be OK.

However, IOS does not want developers to traverse all cells, so our final perfect solution is to split the logic, split the design, and update the data one by one, so it is better for IOS.

The trick mentioned above should be an emergency.

Related Article

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.