按钮字体添加下划线

NSMutableAttributedString * string = [[NSMutableAttributedString alloc] initWithString:@"立即注册"];

    

    NSRange strRange = {0,[string length]};

    

    [string addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange];

    [string addAttribute:NSForegroundColorAttributeName value:[UIColorlightGrayColor] range:strRange];

    [signButton setAttributedTitle:string forState:UIControlStateNormal];

原文地址:https://www.cnblogs.com/block123/p/4947376.html