NSString * str = [NSString stringWithFormat:@"发送发送粉红色三大部分是白癜风是东北风科技舍不得分公司的后果开始加班到福建省"];
//NSString * str = [NSString stringWithFormat:@"不开的大沙发北京三大部分说不定 "];
UILabel * textLabel = [[UILabel alloc] init];
textLabel.frame = CGRectMake(100, 100, 100, 90);
textLabel.font = [UIFont systemFontOfSize:14];
textLabel.text = str;
textLabel.numberOfLines = 0;
textLabel.backgroundColor = [UIColor redColor];
[self.view addSubview:textLabel];
NSDictionary * textDic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:14], NSFontAttributeName, nil];
CGRect rect = [str boundingRectWithSize:CGSizeMake(100, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:textDic context:nil];
textLabel.frame = CGRectMake(100, 100, 100, rect.size.height);
NSLog(@"自适应高度====%f",rect.size.height);
//NSString * str = [NSString stringWithFormat:@"不开的大沙发北京三大部分说不定 "];
UILabel * textLabel = [[UILabel alloc] init];
textLabel.frame = CGRectMake(100, 100, 100, 90);
textLabel.font = [UIFont systemFontOfSize:14];
textLabel.text = str;
textLabel.numberOfLines = 0;
textLabel.backgroundColor = [UIColor redColor];
[self.view addSubview:textLabel];
NSDictionary * textDic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:14], NSFontAttributeName, nil];
CGRect rect = [str boundingRectWithSize:CGSizeMake(100, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:textDic context:nil];
textLabel.frame = CGRectMake(100, 100, 100, rect.size.height);
NSLog(@"自适应高度====%f",rect.size.height);