UILabel常⽤属性⼩结标签常⽤的属性:
(1)frame属性:设置标签的位置与⼤⼩。
frame = CGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height);
(2)origin属性:设置标签的位置,即标签左上⾓的坐标。
origin = CGPointMake(CGFloat x, CGFloat y);
(3)size属性:设置标签的⼤⼩,即标签的宽⾼。
size = CGSizeMake(CGFloat width, CGFloat height);
(4)text属性:设置⽂本的内容。
(5)font属性:设置⽂本字体的⼤⼩。
  常⽤的三种⽅法:
  + (UIFont *)systemFontOfSize:(CGFloat)fontSize;
  + (UIFont *)systemFontOfSize:(CGFloat)fontSize weight:(CGFloat)weight
  + (UIFont *)fontWithName:(NSString *)fontName size:(CGFloat)fontSize;
(6)textAlignment属性:设置⽂本在标签中的位置。
  NSTextAlignmentLeft    //⽂本内容在标签中左对齐
html设置字体颜属性  NSTextAlignmentCenter  //⽂本内容在标签中居中
  NSTextAlignmentRight  //⽂本内容在标签中右对齐
(7)textColor属性:设置⽂本字体颜⾊。
(8)shadowColor属性:设置⽂本阴影颜⾊。
(9)shadowOffset属性:设置⽂本阴影偏移量。
(10)backgroundColor属性:设置标签的背景⾊。
(11)numberOfLines属性:设置标签中⽂本的⾏数,其中0表⽰可以显⽰多⾏。
(12)adjustsFontSizeToFitWidth属性:设置⽂本⽂字是否⾃适应标签的⼤⼩。
Example:
//创建标签并设置它的位置和⼤⼩
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 200, 100)];
//设置⽂本内容
< = @"hehe";
//设置⽂本字体⼤⼩与宽度
label.font = [UIFont systemFontOfSize:30 weight:10];
//设置⽂本内容居中
//设置⽂本字体颜⾊为黄⾊
//设置⽂本阴影颜⾊
label.shadowColor = [UIColor blueColor];
//设置⽂本阴影偏移量
label.shadowOffset = CGSizeMake(2, 2);
//设置标签背景⾊为浅灰⾊
label.backgroundColor = [UIColor lightGrayColor];    //设置标签的⽂本可以显⽰多⾏
label.numberOfLines = 0;
//设置⽂本⽂字⾃适应标签的⼤⼩
label.adjustsFontSizeToFitWidth = YES;
//将标签加⼊视图
[self.view addSubview:label];