采用富文本的形式增加下划线
- (void)SetUnderLine:(UIButton*)btn setTitle:(NSString*)title
{
NSMutableAttributedString*str = [[NSMutableAttributedStringalloc]initWithString:title];
NSRangestrRange = {0,[strlength]};
[straddAttribute:NSUnderlineStyleAttributeNamevalue:[NSNumbernumberWithInteger:NSUnderlineStyleSingle]range:strRange];
[btnsetAttributedTitle:strforState:UIControlStateNormal];
}
网友评论