根据文字,字号,宽度确定高度

简介: -(CGFloat)heightWithWidth:(CGFloat)width andString:(NSString *)str andFontSize:(int)fontSize{ CGSize titleSize = [str boun...
-(CGFloat)heightWithWidth:(CGFloat)width andString:(NSString *)str andFontSize:(int)fontSize{
    CGSize titleSize = [str boundingRectWithSize:CGSizeMake(width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:fontSize]} context:nil].size;
    return titleSize.height;
}

目录
相关文章
|
4天前
根据字符串内容、最大宽度和字体计算行宽和高度
根据字符串内容、最大宽度和字体计算行宽和高度
10 0
|
9天前
表格宽度和高度
表格宽度和高度。
14 1
|
13天前
字体大小
字体大小。
16 0
|
C#
C#中,让按钮文字垂直水平都居中
C#中,让按钮文字垂直水平都居中
114 0
Markdown设置字体大小、颜色...,CSDN博客编写设置字体大小、颜色、粗细。字体,文字背景设置。
Markdown设置字体大小、颜色...,CSDN博客编写设置字体大小、颜色、粗细。字体,文字背景设置。
591 0
Markdown设置字体大小、颜色...,CSDN博客编写设置字体大小、颜色、粗细。字体,文字背景设置。