修改string单个字符大小颜色

来源:互联网 发布:淘宝刷销量团队 编辑:程序博客网 时间:2024/06/17 02:20
//字体大小 和颜色
let attributedString = NSMutableAttributedString(string: “阿斯顿发送发送到阿斯顿发生地方”)
         
        let color = UIColor.redColor()
         
        let normalAttributes = [NSForegroundColorAttributeName : color,NSFontAttributeName:UIFont.boldSystemFontOfSize(20)]
         
        attributedString.addAttributes(normalAttributes, range: NSMakeRange(1,2))
         
        self.newRanking.attributedText = attributedString
0 0
原创粉丝点击