UIView * Headview = [[UIView alloc]initwithframe:cgrectmake (0, 0, self.tbSecond.size.width, 0)];
Headview.backgroundcolor = [Uicolor Whitecolor];
UIView * view = [[UIView alloc]initwithframe:cgrectmake (Max, self.tbsecond.bounds.size.width-90, 0)];
View.layer.borderWidth = 1;
View.layer.borderColor = [Uicolor Orangecolor]. Cgcolor;
View.backgroundcolor = [Uicolor Whitecolor];
UILabel * Contentlabel = [[UILabel alloc]initwithframe:cgrectmake (self.tbsecond.bounds.size.width-120, 0)];
Contentlabel.numberoflines = 0;
Contentlabel.linebreakmode = nslinebreakbycharwrapping;
Contentlabel.font = [Uifont systemfontofsize:12];
Contentlabel.textcolor = [Uicolor Redcolor];
Contentlabel.text = visitmodel.record?visitmodel.record:@ "";
Cgsize textSize1 = [Visitmodel.record boundingRectWithSize:view.bounds.size options: Nsstringdrawinguseslinefragmentorigin | Nsstringdrawingtruncateslastvisibleline Attributes:nil context:nil].size;
NSLog (@ "%f", textsize1.height);
CGRect rect = contentlabel.frame;
Rect.size.height = textsize1.height+30;
Contentlabel.frame = rect;
[View Addsubview:contentlabel];
View.height = Rect.size.height + 45;
[Headview Addsubview:view];
Headview.height = Rect.size.height + 105;
UIView * ShowView = [[UIView alloc]initwithframe:cgrectmake (view.center.x-40, 20, 120, 40)];
Showview.backgroundcolor = [Uicolor Whitecolor];
Uiimageview * Headiv = [[Uiimageview alloc]initwithframe:cgrectmake (0, 0, 40, 40)];
Headiv.image = [UIImage imagenamed:@ "Home_circle_icon"];
[ShowView Addsubview:headiv];
Uiimageview * HEADIMV = [[Uiimageview alloc]initwithframe:cgrectmake (10, 10, 30, 30)];
HeadIMV.layer.cornerRadius = 15;
HeadIMV.layer.masksToBounds = YES;
[Headimv sd_setimagewithurl:[nsurl URLWithString:visitModel.headPicUrl] placeholderimage:[uiimage imagenamed:@ " Home_headpic "];
[ShowView ADDSUBVIEW:HEADIMV];
Uiimageview * Lianxiwo = [[Uiimageview alloc]initwithframe:cgrectmake (50, 7, 25, 25)];
Lianxiwo.image = [UIImage imagenamed:@ "Lianxiwo"];
[ShowView Addsubview:lianxiwo];
Uiimageview * Dianhua = [[Uiimageview alloc]initwithframe:cgrectmake (90, 7, 25, 25)];
Dianhua.image = [UIImage imagenamed:@ "Dianhua"];
[ShowView Addsubview:dianhua];
UIButton * lianxiwobtn = [[UIButton alloc]initwithframe:cgrectmake (45, 2, 35, 35)];
[Lianxiwobtn addtarget:self Action: @selector (Lianxiwobtnclick) forcontrolevents:uicontroleventtouchupinside];
[ShowView ADDSUBVIEW:LIANXIWOBTN];
UIButton * dianhuabtn = [[UIButton alloc]initwithframe:cgrectmake (80, 2, 35, 35)];
[Dianhuabtn addtarget:self Action: @selector (Dianhuabtnclick) forcontrolevents:uicontroleventtouchupinside];
[ShowView ADDSUBVIEW:DIANHUABTN];
[Headview Addsubview:showview];
UILabel * Companylabel = [[UILabel alloc]initwithframe:cgrectmake (view.center.x-60, headview.height-30, 120, 20)];
Companylabel.backgroundcolor = [Uicolor Whitecolor];
Companylabel.textalignment = Nstextalignmentcenter;
Companylabel.font = [Uifont systemfontofsize:14];
Companylabel.textcolor = [Uicolor Orangecolor];
Companylabel.text = visitmodel.username?visitmodel.username:@ "";
[Headview Addsubview:companylabel];
UILabel * TimeLabel = [[UILabel alloc]initwithframe:cgrectmake (self.tbsecond.bounds.size.width-60, HEADVIEW.HEIGHT-35, 60, 20)];
Timelabel.textalignment = Nstextalignmentcenter;
Timelabel.font = [Uifont systemfontofsize:12];
Timelabel.textcolor = Mrgbtocolor (0x999999);
Timelabel.text = visitmodel.time?visitmodel.time:@ "";
[Headview Addsubview:timelabel];
[Self.view Addsubview:headview];
You can also write the above-mentioned TableView Headview
Combine TableView to achieve the following effects
iOS adapts to text and then builds a similar effect as follows