标签:
//gzz0223
//计算文本的大小
NSString *srring=[NSString stringWithFormat:@"%@",[dataDic objectForKey:@"content"]];
NSUserDefaults * userdefaults =USERDEFAULT;
[userdefaults setValue:srring forKey:@"zixunxiangqing"];
[userdefaults synchronize];
CGSize size111 = [srring boundingRectWithSize:CGSizeMake(250, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15.0]} context:nil].size;
// 气泡素材
UIImage* leftImage = [UIImage imageNamed:@"ReceiverTextNodeBkg.png"];
leftImage = [leftImage stretchableImageWithLeftCapWidth:30 topCapHeight:35];
//
CGFloat xx=85;
CGFloat yy=20;
CGFloat ww=ConentViewWidth-90;
CGFloat hh=size111.height+20;
注:不行的话 改变红色字体,实在不行的话 试试绿色
UIImageView *coverImage = [[UIImageView alloc] initWithFrame:CGRectMake(xx,yy , ww, hh)];
coverImage.image = leftImage;
[self.view addSubview:coverImage];
UILabel *l=[[ UILabel alloc]initWithFrame:CGRectMake(10+8, 80, ConentViewWidth- 20, 100)];
l.frame =CGRectMake(85+13, 20+8,ConentViewWidth-105, size111.height);
l.text=srring;
l.numberOfLines = 0;
l.lineBreakMode = NSLineBreakByWordWrapping;
[self.view addSubview:l];
标签:
原文地址:http://www.cnblogs.com/gzz2016/p/5209333.html