-(void) Setmessage: (Gylmessagemodel*) Message
{
_message = message;
// width of the screen
cgfloat screenwidth = [uiscreen mainscreen]. Bounds. Size. width;
// Clearance
cgfloat padding = ten;
// Time
cgfloat TimeX = 0;
cgfloat timey = 0;
cgfloat Timew = screenwidth;
cgfloat Timeh = ;
_timef = cgrectmake(TimeX, Timey, Timew, Timeh);
//2. Avatar
cgfloat iconh = ;
cgfloat iconw = ;
cgfloat icony = cgrectgetmaxy(_timef) + padding;
cgfloat IconX = 0;
if (gylmessagemodeltypeme = = _message. type ) {// sent by oneself
//x = screen width - gap - avatar width
IconX = screenwidth-padding-iconw;
}Else IconX = padding;
_iconf = cgrectmake(IconX, Icony, Iconw, Iconh);
//3. Body
nsdictionary * dict = @{nsfontattributename :gyltextfont} ;
cgsize maxsize = CGSizeMake ( Span style= "Color:rgb (39,42,216)" >200 , maxfloat );
cgsize textsize = [ _message text   boundingrectwithsize:maxSize options: Nsstringdrawinguseslinefragmentorigin   attributes:d ict context : nil size
cgfloat textw = textSize. width;
cgfloat texth = textSize. height;
cgfloat texty = icony;
cgfloat textx = 0;
if ( gylmessagemodeltypeme ==  _message type // self-made
//x = avatar x- Gap - width of text
TEXTX = ICONX-PADDING-TEXTW;
}Else
{
maximum x+ clearance of// avatar
TEXTX = cgrectgetmidx(_iconf) + padding;
}
_TEXTF = cgrectmake(TEXTX, texty, TEXTW, texth);
//4. Row Height
cgfloat maxicony = cgrectgetmaxy(_iconf);
cgfloat maxtexty = cgrectgetmaxy(_textf);
//_cellheight = (Maxicony > maxtexty?) (Maxicony + padding): (maxicony + padding));
_cellheight = MAX(maxicony, maxtexty) + padding;
}
Customize the frame settings for each space in the cell QQ as an example