UILabel添加中划线、下划线

来源:互联网 发布:jdk java se 32w xz 编辑:程序博客网 时间:2024/05/21 06:33

此需求主要是用来显示价格,实现打折效果


//中划线

NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};

        //下划线

        NSDictionary *attribtDic = @{NSUnderlineStyleAttributeName: [NSNumbernumberWithInteger:NSUnderlineStyleSingle]};

        NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:oldStrattributes:attribtDic];

        oldPriceLabel.attributedText = attribtStr;

0 0
原创粉丝点击