UILabel基本用法

 1 UILabel *_label = [[UILabel alloc]initWithFrame:CGRectMake(20,  self.view.frame.size.height*0.5f, self.view.frame.size.width*0.5f, 40)];
 2 _label.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
 3 _label.textColor = [UIColor whiteColor];
 4 _label.layer.cornerRadius = 5;
 5 _label.layer.masksToBounds= YES;
 6 _label .font = [UIFont systemFontOfSize:13];
 7 _label .numberOfLines = 2;
 8 _label .textAlignment = UITextAlignmentCenter;
 9 _label.text = @"轻触";
10 [self.view addSubview:_label];
原文地址:https://www.cnblogs.com/wangshengl9263/p/3457156.html