UILabel的使用

UILabel是iOS用于显示文本的控件。

 1 基本属性如下代码所示:
 2 UILabel *lbl = [[UILabel alloc] init] ;
 3 //设置显示区域
 4 lbl.frame = CGRectMake(100,100,100,40);
 5 //设置字体大小
 6 lbl.font = [UIFont systemFontOfSize:14];
 7 //设置文本
 8 lbl.text = @"test";
 9 //设置文本颜色
10 lbl.textColor = [UIColor redColor];
11 
12 高级属性包括:
13 //设置文本的显示行数,如果设置为0表示根据文本内容和显示区域自动调整
14 lbl.numberOfLines = 0;
15 //设置是否高亮,还可以设置高亮的颜色
16 lbl.highlighted = YES;
17 //设置阴影颜色,还可以设置阴影的偏移量
18 lbl.shadowColor = [UIColor redColor];
原文地址:https://www.cnblogs.com/sunzhenxing19860608/p/5836828.html