Fra*_*s F 5 uitextview nsattributedstring ios swift4 xcode9-beta
我正在使用下面的方法在Swift 3中将textView.typingAttributes前景色设置为红色.
textView.typingAttributes[NSForegroundColorAttributeName] = UIColor.red
Run Code Online (Sandbox Code Playgroud)
现在,我已经向Swift 4迁移了它的显示错误,我尝试如下,但它仍然显示错误.什么是正确的设置方式?
textView.typingAttributes[NSAttributedStringKey.foregroundColor] = UIColor.red
Run Code Online (Sandbox Code Playgroud)
试试这个:
textView.typingAttributes[NSAttributedStringKey.foregroundColor.rawValue] =
UIColor.red
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1516 次 |
| 最近记录: |