我想用这段代码将我选中的textview中的内容更改一个字体,但是没有起作用。大神们知道为什么么?
let string = NSMutableAttributedString(string: bodyView.inputBodyTV.text) string.addAttribute(NSFontAttributeName, value: UIFont.boldSystemFontOfSize(15), range: selecteRange)
学习是最好的投资!
Check if selecteRange is correct
Use textView.attributedText, not textView.text
After modification, you need to reassign textview
+1 from upstairs, use textView.attributedText, not textView.text
Check if selecteRange is correct
Use textView.attributedText, not textView.text
After modification, you need to reassign textview
+1 from upstairs, use textView.attributedText, not textView.text