【发布时间】:2009-12-24 12:27:58
【问题描述】:
如何在NSTextView 中设置行高或行距(即每行有多高,或者每行之间有多少空间)?
【问题讨论】:
标签: objective-c cocoa alignment nstextview
如何在NSTextView 中设置行高或行距(即每行有多高,或者每行之间有多少空间)?
【问题讨论】:
标签: objective-c cocoa alignment nstextview
留下答案以防有人需要:
NSMutableParagraphStyle * myStyle = [[NSMutableParagraphStyle alloc] init];
[myStyle setLineSpacing:10.0];
[myTextView setDefaultParagraphStyle:myStyle];
【讨论】:
在你的 NSTextView 中使用- (void)setDefaultParagraphStyle:(NSParagraphStyle *)paragraphStyle 方法。
NSParagraphStyle 上的文档
NSMutableParagraphStyle 中有一个setLineSpacing: 方法。还有一些与行高相关的方法,NSMutableParagraphStyle 文档中“设置其他样式信息”下的方法应该很有用。
我想这就是你要找的。p>
【讨论】: