views:

175

answers:

1

How would I set the Line Height/ Line Spacinh in an NSTextView? e.g How tall each line is or how much space is between each line.

+7  A: 

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. =]

Michael
How do I change the NSParagraphStyle to NSMutableParagraphStyle so the setLineSpacing: method will work as this is what I have now (in a NSTextView subclass) http://grab.by/1ppb. And I get that warning for that problem.
Joshua
Change the (NSParagraphStyle *) to (NSMutableParagraphStyle *)
Michael
Thanks, I've just down that but it doesn't actually change the line spacing, any idea why?
Joshua