开发者

Setting the Line Height/ Line Spacing in an NSTextView

开发者 https://www.devze.com 2022-12-14 15:56 出处:网络
How would I set the Line Height or Line Spacing in an NSTextView (i.e. how tall eac开发者_开发技巧h line is, or how much space is between each line)?leave the answer in case someone need:

How would I set the Line Height or Line Spacing in an NSTextView (i.e. how tall eac开发者_开发技巧h line is, or how much space is between each line)?


leave the answer in case someone need:

NSMutableParagraphStyle * myStyle = [[NSMutableParagraphStyle alloc] init];
[myStyle setLineSpacing:10.0];
[myTextView setDefaultParagraphStyle:myStyle];


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消