sizeWithFont:constrainedToSize:lineBreakMode的使用 (2012-03-20 10:48:40)转载▼ 标签: 宽度 字符串 获取 指定 用于 杂谈 分类:
2013-10-15 11:38
826 查看
sizeWithFont:constrainedToSize:lineBreakMode的使用
(2012-03-20 10:48:40)转载▼
标签: | 分类: IPhone |
CGSize size = [text sizeWithFont:font constrainedToSize:CGSizeMake(150.0f, 1000.0f) lineBreakMode:UILineBreakModeCharacterWrap];
获取字符串在指定的size内(宽度超过150,则换行)所需的的实际高度和宽度.
将获取的宽度和高度用于UILabel
UILabel *bubbleText = [[UILabel alloc] initWithFrame:CGRectMake(21.0f, 14.0f, size.width+10, size.height+10)];
bubbleText.backgroundColor = [UIColor clearColor];
bubbleText.font = font;
bubbleText.numberOfLines = 0;
bubbleText.lineBreakMode = UILineBreakModeCharacterWrap;
bubbleText.text = text;
相关文章推荐
- 宽度高度sizeWithFont:constrainedToSize:lineBreakMode的使用
- UITextView使用 sizeWithFont:constrainedToSize:lineBreakMode:计算自适应文本高度
- UITextView使用 sizeWithFont:constrainedToSize:lineBreakMode:计算自适应文本高度
- UITextView使用 sizeWithFont:constrainedToSize:lineBreakMode:计算自适应文本高度
- sizeWithFont:constrainedToSize:lineBreakMode的使用
- sizeWithFont:constrainedToSize:lineBreakMode的使用
- sizeWithFont:constrainedToSize:lineBreakMode:方法在IOS7中过时
- IOS7.0 sizeWithFont:constrainedToSize:lineBreakMode:方法 iOS7 Deprecated
- [ios]tableView内部cell因内容大小变换 而变化 sizeWithFont:constrainedToSize: lineBreakMode:
- IOS7.0 sizeWithFont:constrainedToSize:lineBreakMode:方法 iOS7 Deprecated
- IOS7.0 sizeWithFont:constrainedToSize:lineBreakMode:方法
- IOS7.0 sizeWithFont:constrainedToSize:lineBreakMode:方法
- boundingRectWithSize:options:attributes:context:代替sizeWithFont:constrainedToSize:lineBreakMode:
- iPhone:constrainedToSize获取字符串的宽高 自定义label的高度和宽度
- IOS高访微信聊天对话界面(sizeWithFont:constrainedToSize和stretchableImageWithLeftCapWidth的使用)
- iPhone:constrainedToSize获取字符串的宽高 自定义label的高度和宽度
- IOS高访微信聊天对话界面(sizeWithFont:constrainedToSize和stretchableImageWithLeftCapWidth的使用)
- 自动调整文字高度With what should I replace the deprecated sizeWithFont:contrainedToSize:lineBreakMode method?
- iPhone:constrainedToSize获取字符串的宽高 自定义label的高度和宽度
- IOS高访微信聊天对话界面(sizeWithFont:constrainedToSize和stretchableImageWithLeftCapWidth的使用)