【发布时间】:2018-03-10 06:53:45
【问题描述】:
我正在尝试创建 AttributedString 并添加来自
的属性typingAttributes(from textView)
问题是
.typingAttributes
返回
[String, Any]
和
NSAttributedString(string:.. , attributes:[])
需要
[NSAttributedStringKey: Any]
我的代码:
NSAttributedString(string: "test123", attributes: self.textView.typingAttributes)
我不想在循环中创建 for 来遍历所有键并将它们更改为
NSAttributedStringKey
【问题讨论】:
-
我想知道为什么 typingAttributes 字典中的键是字符串而不是 NSAttributedStringKey。您可能需要提交错误报告。
-
我会,但现在我想让它工作
-
看起来有两个开放雷达可以解决这个问题:openradar.appspot.com/34994725 和 openradar.appspot.com/34402659
-
我一个月前报告了这个错误,但苹果仍然没有回应。别担心。