代碼如下
NSMutableAttributedString *attributedString1 = [[NSMutableAttributedString alloc]initWithString:Label.text];[attributedString1 addAttribute:NSForegroundColorAttributeName value:BuleTextColor range:NSMakeRange(0,20)];Label.attributedText = attributedString1;真機(jī)運(yùn)行后全局?jǐn)帱c(diǎn)斷在了 [attributedString1 addAttribute:NSForegroundColorAttributeName value:BuleTextColor range:NSMakeRange(0,20)];這句代碼
報(bào)錯(cuò)原因是:range長(zhǎng)度越界 解決辦法:檢查L(zhǎng)abel.text的長(zhǎng)度是否達(dá)到20
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注