给UILabel添加下划线
1 NSMutableAttributedString *content = [[NSMutableAttributedString alloc]initWithString:text]; 2 NSRange contentRange = {0,[content length]}; 3 [content addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:contentRange]; 4 5 [_titleLabel setAttributedText:content];
时间: 2024-11-05 15:52:59