UILabel 详解

UILabel *label = [[UILabel alloc] init];
    label.frame = self.view.bounds; // 设置大小
    label.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin 
    | UIViewAutoresizingFlexibleWidth
    | UIViewAnimationTransitionNone
    | UIViewAutoresizingFlexibleHeight
    | UIViewAnimationTransitionFlipFromLeft; // 设置label与父容器的关系
    
    label.backgroundColor = [UIColor blackColor]; // 背景颜色
    label.textColor = [UIColor redColor];         // 文本颜色
    label.font = [UIFont fontWithName:@"Zapfino" size:48.0f]; // 字体
    
    label.adjustsFontSizeToFitWidth = YES; // 当文本超过Label宽度时是否缩放字体
    
    label.numberOfLines = 10;   // 行数
    
    label.highlighted = YES;    // 点击时是否高亮
    label.highlightedTextColor = [UIColor grayColor]; // 高亮时的颜色
    
    label.shadowOffset = CGSizeMake(1, 1);           // 阴影的偏移值
    label.shadowColor = [UIColor greenColor];        // 阴影颜色
原文地址:https://www.cnblogs.com/sell/p/2891660.html