代码如下
NSMutableAttributedString *attributedString1 = [[NSMutableAttributedString alloc]initWithString:Label.text];[attributedString1 addAttribute:NSForegroundColorAttributeName value:BuleTextColor range:NSMakeRange(0,20)];Label.attributedText = attributedString1;真机运行后全局断点断在了 [attributedString1 addAttribute:NSForegroundColorAttributeName value:BuleTextColor range:NSMakeRange(0,20)];这句代码
报错原因是:range长度越界 解决办法:检查Label.text的长度是否达到20
新闻热点
疑难解答
图片精选