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); }