字体的下划线

 NSString * sit= @"忘记密码";
   
    NSMutableAttributedString *sti =[[NSMutableAttributedString alloc]initWithString:sit];
 
 
 //设置背景颜色以及下划线
    NSDictionary * dict1 = @{//字体颜色
                             NSForegroundColorAttributeName:[UIColor colorWithRed:33/255.0 green:125/255.0 blue:192/255.0 alpha:1],
                             NSFontAttributeName:[UIFont fontWithName:@"Helvetica-Bold" size:19],
                             NSUnderlineStyleAttributeName:@"1"};
   
    //从下标14开始,长度为6的内容添加多个属性,dict1里面写的就是添加的属性
    [sti addAttributes:dict1 range:NSMakeRange(0, 4) ];
一天一章
原文地址:https://www.cnblogs.com/hangman/p/5625309.html