1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 100, 300, 100)];
<br>
<br> label.numberOfLines = 0;
<br>
<br> label.lineBreakMode = NSLineBreakByWordWrapping;
<br>
<br> label.text = @
"本店于十一期间特推出一系列优惠,限时限量敬请选购!<br>沙发:钻石品质,首领风范!<br>床垫:华贵典雅,彰显时尚!<br>尊贵而不失奢华,典雅却不失自然!温馨和浪漫的生活,我们与你一同创造!<br>"
;
<br>
<br> CGSize size = [label sizeThatFits:CGSizeMake(label.frame.size.width, MAXFLOAT)];
<br>
<br> label.frame =CGRectMake(10, 100, 300, size.height);
<br>
<br> label.font = [UIFont systemFontOfSize:14];
<br>
<br> [self.view addSubview:label];
转 :http://www.cocoachina.com/bbs/read.php?tid=257353
|
UILabel如何自适应高度(自动换行)
最新推荐文章于 2021-01-14 07:11:39 发布