Prepareforreuse method of uitableviewcell

Source: Internet
Author: User

How can we know how to reuse cells in advance? The prepareforreuse header file of cell rewriting is described in. if the currently allocated cell is reused (usually scrolling out of the screen), the cell prepareforreuse will be called to notify the cell. note that when you override the method here, you must call the parent class method [Super prepareforreuse]. pay special attention to this when using cell as the proxy container for network access. You need to cancel the previous network request here. do not send data to this cell.

// If the cell is reusable (has a reuse identifier), this is called just before the cell is returned from the table view method dequeuereusablecellwithidentifier:. If you override, you must call super.

-(Void) prepareforreuse
{
[Super prepareforreuse];
}


Many methods of customizing uitableviewcell have found that some people may encounter image disorder in their defined cells. This problem is often caused by the absence of the prepareforreuse method.

Uitableviewcell is used when scrolling down. The cell used is the one that slides out, the information displayed in the sliding cell appears here. The solution is to implement the perpareforreuse method in the subclass of uitableviewcell and clear the content.


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.