设置textView.typingAttributes前景色斯威夫特4
问题描述:
我用下面的方法来设置我的textView.typingAttributes前景色为红色雨燕现在3设置textView.typingAttributes前景色斯威夫特4
textView.typingAttributes[NSForegroundColorAttributeName] = UIColor.red
,我已经迁移到斯威夫特4它的显示错误,我尝试像下面,但它仍然显示错误。什么是正确的方法来设置它?
textView.typingAttributes[NSAttributedStringKey.foregroundColor] = UIColor.red
答
试试这个:
textView.typingAttributes[NSAttributedStringKey.foregroundColor.rawValue] =
UIColor.red