在 NSTextView 中设置行高/行距
如何在 NSTextView 中设置行高或行距(即每行有多高,或者每行之间有多少空间)?
How would I set the Line Height or Line Spacing in an NSTextView
(i.e. how tall each line is, or how much space is between each line)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
留下答案,以防有人需要:
leave the answer in case someone need:
在 NSTextView 中使用
- (void)setDefaultParagraphStyle:(NSParagraphStyle *)paragraphStyle
方法。关于 NSParagraphStyle 的
文档 NSMutableParagraphStyle
NSMutableParagraphStyle 中有一个
setLineSpacing:
方法。还有与行高相关的方法,NSMutableParagraphStyle 文档中“设置其他样式信息”下的方法应该很有用。我想这就是你要找的。
Use the
- (void)setDefaultParagraphStyle:(NSParagraphStyle *)paragraphStyle
method in your NSTextView.Documentation on NSParagraphStyle
Documentation on NSMutableParagraphStyle
There is a
setLineSpacing:
method in NSMutableParagraphStyle. There are also methods relating to line height, the methods under "Setting Other Style Information" in the NSMutableParagraphStyle documentation should prove useful.I think that's what you're looking for.