Contenting deprecated sizeWithFont:constrainedToSize to boundingRectWithSize:options:attributes:context:
问题 How can I convert CGSize labelHeighSize = [text sizeWithFont: [UIFont systemFontOfSize:16] constrainedToSize:maximumSize lineBreakMode:NSLineBreakByTruncatingTail]; to CGSize labelHeighSize = [text boundingRectWithSize:maximumSize options: attributes: context: 回答1: First of all the method: - (CGRect) boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(NSDictionary *)attributes context:(NSStringDrawingContext *)context; returns CGRect not the CGSize so you