UILabel 添加 文本下划线
2021-06-24 本文已影响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];
