您的位置:首页 > 移动开发 > IOS开发

IOS 字符串高度

2016-01-19 18:43 561 查看
测试代码

- (void)testStrFrame
{
NSString  *ContentStr = @"ennghjkjhgfdfghjkjhgfwertyuiowertyuioertyuqwertyuiedrtyuiwertyuwertywertyyuiowertyuioertyuqwertyuiedrtyuiwertyuwertywerty";

CGSize size = [ContentStr getSizeWithFont:[UIFont systemFontOfSize:15] constrainedToSize:CGSizeMake(320, MAXFLOAT)];

UILabel *_labelTest = [[UILabel alloc]init];
_labelTest.numberOfLines = 0;
_labelTest.font = [UIFont systemFontOfSize:15];
_labelTest.frame = CGRectMake(0, 64, 320,size.height);
_labelTest.text = ContentStr;

[self.view addSubview:_labelTest];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: