Green and blue box, Uilabel display name, label box with the length of the name and adaptive, followed by the gender image followed by the display
Divided into two parts: first Part first layout
Name
Self.namelab = [[UILabel alloc]initwithframe:cgrectmake (0, Screen_width, 20)];
Self.nameLab.textColor = [Uicolor Whitecolor];
Self.nameLab.font = [Uifont fontwithname:@ "Helvetica-blod" size:19];
Self.nameLab.textAlignment = Nstextalignmentcenter;
Self.nameLab.backgroundColor = [Uicolor Clearcolor];
[SELF.BGV AddSubview:self.nameLab];
Gender
Self.seximageview = [[Egoimageview alloc]init];
[SELF.BGV AddSubview:self.sexImageView];
The second part of the analysis of the data, according to the content of the adaptive width, and then reset the location of the gender picture
Self.nameLab.text = self.membernmstr;//Name
[Self.namelab SizeToFit];
Cgsize size = [Self.nameLab.text sizewithfont:[uifont systemfontofsize:19] Constrainedtosize:cgsizemake (screen_width , linebreakmode:nslinebreakbywordwrapping];
CGRect r1 = self.nameLab.frame;
R1.size.width = Size.width;
Self.nameLab.frame = R1;
Self.nameLab.center = Cgpointmake (SELF.BGV.FRAME.SIZE.WIDTH/2, 130+10);
[Self.seximageview setframe:cgrectmake (self.nameLab.frame.size.width + self.nameLab.frame.size.width + 10, 130, 20, 20 )];
CGRect r2 = self.sexImageView.frame;
r2.origin.x = self.namelab.frame.origin.x + ten + self.nameLab.frame.size.width;
Self.sexImageView.frame = R2;
Ios-uilabel is centered with the content, followed by the control followed by the