【发布时间】:2018-01-05 21:43:03
【问题描述】:
在使用 Swift 3.2 的 macOS 项目中,我正在尝试设置 UITextView 的前景色。
let placeHolderTitleString: NSAttributedString = NSAttributedString(string: "Enter text here", attributes: [NSAttributedStringKey.foregroundColor : NSColor.gray]) // error
我得到的错误是这样的:
类型“NSAttributedStringKey”(又名“NSString”)没有成员 '前景颜色'
相同的代码在 Swift 4.0 项目中运行良好。
我正在尝试根据我为 iOS Swift 4 Conversion error - NSAttributedStringKey: Any 找到的一些答案修改代码,但我仍然遇到错误。有没有办法在不将项目更新到 Swift 4 的情况下解决这个问题?
【问题讨论】:
标签: swift macos nsattributedstring nsattributedstringkey