IOS Miscellaneous Pen-How to solve TableView display disorder problem

Source: Internet
Author: User

Resolve Custom Tableviewcell Display confusion problems
    • If we want to solve this problem, we need to use the Prepareforreuse method of UITableViewCell.

    • Cell is reused how to know in advance? The Prepareforreuse official header file that rewrites the cell is described in. If the currently allocated cell is reused (usually scrolled out of the screen), the cell's Prepareforreuse notification cell is called. Note that when this method is overridden, Note Be sure to call the parent class method [Super Prepareforreuse]. This is especially important when using the cell as a proxy container for network access, where you need to be notified to cancel the previous network request. Don't send data to this cell again.

      // 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];}

There are many ways to customize UITableViewCell. Some people will encounter the problem of image confusion in their defined cell, which is often caused by the lack of implementation of the Prepareforreuse method.

UITableViewCell is reused when scrolling down, the cell that is used is the one that slides out, and the information displayed in the slide-out cell appears here the solution is to implement the Perpareforreuse method in the UITableViewCell subclass, Clear out the contents.

IOS Miscellaneous Pen-How to solve TableView display disorder problem

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.