iOS Lable给文字添加中划线和下划线

 

 NSDictionary *attribtDic = @{NSUnderlineStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
    
    NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:@"下划线" attributes:attribtDic];
    
    self.label1.attributedText = attribtStr;
    NSDictionary *attribtDic2 = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
    
    NSMutableAttributedString *attribtStr2 = [[NSMutableAttributedString alloc]initWithString:@"中划线" attributes:attribtDic2];
    
    self.label2.attributedText = attribtStr2;

posted @ 2015-12-23 16:41  无边小仙  阅读(2178)  评论(0编辑  收藏  举报