天天看點

NSMutableAttributedString設定内容的屬性

//開始編輯

[attrStr beginEditing];

//設定文字顔色

[attrStr addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:range];

//設定文字大小

[attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:17] range:range];

//結束編輯

[attrStr endEditing];

參數1:設定的内容,有好多在頭檔案裡面.

參數2:設定值

參數3:編輯的範圍