美文网首页
UIlabel 富文本拼接

UIlabel 富文本拼接

作者: 林小姐的那片海 | 来源:发表于2017-09-28 15:46 被阅读0次
        let t_icon  = UIImage.init(named: "recommend")
        //商品现价
        let cp = "¥ " + (data?["price"] as! String?)!

        currentprice.attributedText = UILabel.fixAttributedStr(withTexts: [cp], textColors: [UIColor.red], textfonts: [UIFont.systemFont(ofSize: 10)], image: nil, insert: nil, imageBounds: CGRect.init(x: 0, y: 5, width: 15, height: 15), lineSpacing: 5)


        let currentPriceAttri = NSMutableAttributedString.init(string: stra)
        currentPriceAttri.addAttribute(NSForegroundColorAttributeName, value: UIColor.red, range: NSRange.init(location: 0, length: stra.characters.count))

相关文章

网友评论

      本文标题:UIlabel 富文本拼接

      本文链接:https://www.haomeiwen.com/subject/jhfvextx.html