iOS 计算字符串高度
2017-03-22 本文已影响0人
Ice丶泽
- (CGSize)boundingRectWithSize:(CGSize)size
{
NSDictionary *attribute = @{NSFontAttributeName: self.font};
CGSize retSize = [self.text boundingRectWithSize:size
options:
NSStringDrawingUsesLineFragmentOrigin |
NSStringDrawingUsesFontLeading
attributes:attribute
context:nil].size;
return retSize;
}