效果如图
//富文本
NSMutableAttributedString *content = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"发送验证码"]];
NSRange contentRange = {0,[content length]};
[content addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:contentRange];
//button的setAttributedTitle方法
[button setAttributedTitle:content forState:UIControlStateNormal];
本文详细介绍了如何使用Objective-C为按钮添加下划线样式,以突出显示发送验证码的功能,通过设置NSAttributedString和UIButton的attributedTitle属性实现。
1万+

被折叠的 条评论
为什么被折叠?



