Cocoa NSTextView defaultParagraphStyle无效
在我的NSTextView子类中,我有:Cocoa NSTextView defaultParagraphStyle无效,cocoa,swift,desktop-application,nstextview,Cocoa,Swift,Desktop Application,Nstextview,在我的NSTextView子类中,我有: class EditorTextView: NSTextView { override func drawRect(dirtyRect: NSRect) { super.drawRect(dirtyRect) var theParagraphStyle = NSMutableParagraphStyle() theParagraphStyle.lineSpacing = 50 s
class EditorTextView: NSTextView {
override func drawRect(dirtyRect: NSRect) {
super.drawRect(dirtyRect)
var theParagraphStyle = NSMutableParagraphStyle()
theParagraphStyle.lineSpacing = 50
self.defaultParagraphStyle = theParagraphStyle
为什么这对文本视图中的行距没有影响…?如果设置了初始文本,是否会正确显示文本?--用户输入的文本更改段落样式时出现问题。但当我传递初始内容时,这些内容会正确显示(直到用户在段落开头更改内容)。