When iOS uses SegmentController to switch tableView, reloadData will cause repeated data creation. Solution
Place the control created on the Cell in the Cell = nil judgment, so that each time you come in, you will first judge whether there is any, so that you can avoid repeated data creation, resulting in the view becoming thicker and thicker
If (cell = nil ){
Cell = [[UITableViewCellalloc] initWithStyle: UITableViewCellStyleDefaultreuseIdentifier: cellIDD];
Self. inviteLabel = [[UILabelalloc] initWithFrame: CGRectMake (10, 5, [UIScreenmainScreen]. bounds. size. width-20, 120)];
Self. inviteLabel. numberOfLines = 0;
Self. inviteLabel. text = cell_info.title;
Self. inviteLabel. textColor = LABEL_TEXTCOLOR;
Int width = 100;
Int height = 40;
Self. button = [[UIButtonalloc] initWithFrame: CGRectMake ([UIScreenmainScreen]. bounds. size. width/2-width/2,120 + 10, width, height)];
Self. button. backgroundColor = [UIColorredColor];
[Self. buttonsetBackgroundImage: [UIImageimageNamed: cell_info.cp] forState: UIControlStateNormal];
NSLog (@ "cell_info.cp: % @", cell_info.cp );
// Add the long-pressed gesture
UILongPressGestureRecognizer * longPress = [[UILongPressGestureRecognizeralloc] initWithTarget: selfaction: @ selector (longPress :)];
[Self. inviteLabeladdGestureRecognizer: longPress];
LongPress. minimumPressDuration = 1.0;
[Cell. contentViewaddSubview: self. button];
[Cell. contentViewaddSubview: self. inviteLabel];
Cell. backgroundColor = CELL_BACK_COLOR;
}