自适应宽高UILable
sizeWithFont:constrainedToSize:lineBreakMode:Returns the size of the string if it were rendered with the specified constraints.
- (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size lineBreakMode:(UILineBreakMode)lineBreakMode
The font to use for computing the string size.
The maximum acceptable size for the string. This value is used to calculate where line breaks and wrapping would occur.
The line break options for computing the size of the string. For a list of possible values, see NSLineBreakMode
.
The width and height of the resulting string’s bounding box. These values may be rounded up to the nearest whole number.
UIStringDrawing.h