[IOS Tableview] Cell Custom View Display error issue

Source: Internet
Author: User

Problem Description: When you customize the cell's view display according to Tableviewcell's tag, the error condition appears when dragging.

What I do is a download interface, I set the problem to simplify the problem, the Tag==1 cell has been downloaded, loaded with the downloaded cell's label displayed as Blue. The rest defaults to black.

For example, I in the code, want to tag==1 the cell's label font is blue, so write will appear up and down drag tag==11 also appear blue (depending on the situation).

if([cell.tag==1){        //Tag==1 to display the label as BlueCell.label.textcolor=[uicolor colorwithred:79.0f/255.0fGreen148.0f/255.0fBlue205.0f/255.0fAlpha1]; NSLog (@"This file has been downloaded,%d",(int) indexpath.row); }Else{        /*//If the file has already been downloaded, the default label color is black Cell.label.textcolor=[uicolor blackcolor];         NSLog (@ "This file is not downloaded,%d", (int) indexpath.row); */    }

The workaround is to:

Add else, and else fill in the default value you expect

if([cell.tag==1){        //Tag==1 to display the label as BlueCell.label.textcolor=[uicolor colorwithred:79.0f/255.0fGreen148.0f/255.0fBlue205.0f/255.0fAlpha1]; NSLog (@"This file has been downloaded,%d",(int) indexpath.row); }Else{                //If the file has already been downloaded, change the button pattern to tickCell.label.textcolor=[Uicolor Blackcolor]; NSLog (@"This file is not downloaded,%d",(int) indexpath.row); }

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.