The controls created on the cell are placed in the judgment of the cell==nil, so that each time you come in, you will be able to avoid duplicate data creation, resulting in a more thick view.
if (cell==Nil) {
cell=[[uitableviewcellalloc]initwithstyle:uitableviewcellstyledef Aultreuseidentifier: Cellidd];
Self.Invitelabel=[[UILabelAlloc]initWithFrame:CGRectMake(Ten,5,[UIScreenMainscreen].bounds.size.width- -, -)];
Self. Invitelabel. numberoflines=0;
Self. Invitelabel. text=cell_info. title;
Self. Invitelabel. textcolor=Label_textcolor;
int width=;
int height=;
Self. button=[[UIButtonalloc]initwithframe:cgrectmake([UIScreen Mainscreen]. bounds. size. width/2-width/2,+ +, width, height)];
self button Backgroundcolor=[ uicolor redcolor ";
[self. Button setbackgroundimage: [UIImageimagenamed: Cell_info. CP ]forstate:uicontrolstatenormal];
NSLog (@ "cell_info.cp:%@", Cell_info. CP);
// Add long press gesture
uilongpressgesturerecognizer *longpress=[[uilongpressgesturerecognizeralloc]initwithtarget:selfAction:@ Selector(longpress:)];
[Self. Invitelabel addgesturerecognizer: longpress];
Longpress. minimumpressduration=1.0;
[Cell. Contentview addsubview:self. Button];
[Cell. Contentview addsubview:self. Invitelabel];
Cell. backgroundcolor=Cell_back_color;
}
When iOS uses Segmentcontroller to switch TableView, Reloaddata creates a solution for data duplication.