UILabel

UILabel 添加下划线

2021-05-10  本文已影响0人  失忆的程序员

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 120, 320, 40)];
    NSMutableAttributedString *content = [[NSMutableAttributedString alloc] initWithString:@"This is a under line label"];
    NSRange contentRange = {0, [content length]};
    [content addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:contentRange];
    
    label.attributedText = content;
    [self.view addSubview:label];



上一篇 下一篇

猜你喜欢

热点阅读