我正在尝试编写一个简单的示例来修改使用绿色和红色作为正确答案或错误答案的 NSTextfield 的颜色。 我无法实现这一点,因为在使用 NSTextField 的苹果指南页面时,我总是收到一条错误消息,AppKit framework ref.
我正在尝试使用这段代码:
@IBOutlet weak var mensajeResultado: NSTextField!
when trying to colorize it without success
let rango = NSRange(location: 0,length: 0)
mensajeResultado.superclass.setTextColor(NSColor.redColor(), range: rango)
最佳答案
不应该只是:
mensajeResultado.textColor = NSColor.redColor()
?
关于swift - 更改 NSTextField 的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30178438/