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];

 

相关文章:

  • 2022-12-23
  • 2021-08-01
  • 2021-06-27
  • 2022-12-23
  • 2021-08-18
猜你喜欢
  • 2022-12-23
  • 2021-06-21
  • 2021-07-09
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案