NSMutableAttributedString 属性字符串的使用

来源:互联网 发布:w7怎么连接网络打印机 编辑:程序博客网 时间:2024/05/02 00:34

    NSString *priceString = [NSStringstringWithFormat:@"%.2f  ",model.curprice.doubleValue];

    NSMutableAttributedString *attrPriceString = [[NSMutableAttributedStringalloc] initWithString:priceStringattributes:@{NSForegroundColorAttributeName:RGB(253,126, 49),NSFontAttributeName:[UIFontsystemFontOfSize:14],NSStrikethroughStyleAttributeName:@(NSUnderlineStyleNone)}];

    [attrPriceString addAttributes:@{NSFontAttributeName:[UIFontsystemFontOfSize:10]}range:NSMakeRange(0,1)];

   self.priceLabel.attributedText = attrPriceString;


0 0