+ (CGFloat) heightforcontent: (Mymsgtextmodel *) content withwidth: (cgfloat) width {cgsize contentsize; if (System_version_greater_than_or_equal_to (@ "7.0")) {Nsmutableparagraphstyle *paragraphstyle = [[NSMutableParagr
Aphstyle Alloc]init];
Paragraphstyle.linebreakmode = nslinebreakbywordwrapping; Nsdictionary *attributes = @{nsfontattributename:cell_content_font_size, nsparagraphstyleattributename:paragraph
Style.copy};
Nsdictionary *attributes = @{nsfontattributename:cell_content_font_size}; Contentsize = [Content.textmsg boundingrectwithsize:cgsizemake (width, cgfloat_max) options:
Nsstringdrawinguseslinefragmentorigin attributes:attributes context:nil].size; } else{contentsize = [content.textmsg sizewithfont:cell_content_font_size const
Rainedtosize:cgsizemake (width, cgfloat_max) linebreakmode:nslinebreakbywordwrapping]; } return ContentSize.Height; }
2. The height and width of the equipment have not been determined in AutoLayout
You can use Layoutsubviews, but this method is called multiple times, so this method can only be used to control the frame
3. SizeToFit
This method is to let UIView determine the size according to the child view
Commonly used with Uilabel, according to the text to determine the size of the Uilabel
3.-(UIImage *) Stretchableimagewithleftcapwidth: (Nsinteger) leftcapwidth topcapheight:
Let Uiimageview left and top direction not be stretched in a range to make bubbles