字体的下划线

 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) ];
posted @ 2016-06-28 23:02  huangyan1022  阅读(131)  评论(0编辑  收藏  举报