iOS开发 返回字符串的宽高

- (CGFloat)achiveWidthWithHeight:(CGFloat)height Font:(UIFont *)font {

CGSize size = [self boundingRectWithSize:CGSizeMake(MAXFLOAT,

height)

options:NSStringDrawingUsesLineFragmentOrigin

attributes:@{NSFontAttributeName:font}

context:nil].size;

return size.width;

}

- (CGFloat)achiveHeightWithWidth:(CGFloat)width Font:(UIFont *)font {

CGSize size = [self boundingRectWithSize:CGSizeMake(width,

MAXFLOAT)

options:NSStringDrawingUsesLineFragmentOrigin

attributes:@{NSFontAttributeName:font}

context:nil].size;

return size.height;

}

上一篇:POJ 2031 prim


下一篇:java高并发系列 - 第23天:JUC中原子类,一篇就够了