NSInteger n = 6;//最多显示的行数
NSString * labelStr = @"你好,这是UILabel的自";
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 160, 200, 14)];
label.font = [UIFont systemFontOfSize:11];
label.backgroundColor = [UIColor orangeColor];
label.text = labelStr;
label.numberOfLines = 0;
[self.view addSubview:label];
↧
每日一博 | UILabel 自动计算行高切最多显示 6 行
↧