Quantcast
Channel: OSCHINA 社区最新新闻
Viewing all articles
Browse latest Browse all 60135

每日一博 | UILabel 自动计算行高切最多显示 6 行

$
0
0

 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];
    


Viewing all articles
Browse latest Browse all 60135

Trending Articles