关于UILabel

一:创建一个label

UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(15, 100, 345, 100)];

二:UILabel的一些属性

(1) 设置文字:label.text =   @"这是我的一个Label";

(2) 设置文字颜色:label.textColor = [UIColor redColor];

(3) 对齐方式:label.textAlignment = NSTextAlignmentCenter;

(4) 字体:label.font = [UIFont systemFontOfSize:30.f];

(5) 获取字体:NSLog(@"%@",[UIFont familyNames]);

(6) 设置行数:label.numberOfLines = 0;

(7) 设置字体阴影:label.shadowColor = [UIColor cyanColor];

    label.shadowOffset = CGSizeMake(2, 1);

(8) 设置label的颜色:label.backgroundColor = [UIColor blackColor];

效果如下:

 

原文地址:https://www.cnblogs.com/cityingma/p/4839714.html