On 30 Dec 2009, at 9:43 AM, Joshua Garnham wrote:

> 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.
> 
> Here's what I've tried (but doesn't work), it is in a NSTextView subclass … 
> - (void)setDefaultParagraphStyle:(NSMutableParagraphStyle *)paragraphStyle {
>    CGFloat spacing = 5.0f;
>    [paragraphStyle setLineSpacing:spacing];
>    [paragraphStyle setMinimumLineHeight:spacing];
>    [paragraphStyle setMaximumLineHeight:spacing];
> }
> 
> What's wrong with it?

That you modify a proposed default paragraph style, but don't actually SET the 
paragraph style? Such as by [super setDefaultParagraphStyle:]?

Also, declaring that the parameter is a _mutable_ paragraph style does not make 
the parameter you are given actually mutable. The declaration of the method 
specifies NSParagraphStyle, and you must assume you can't change it.

Do you ensure that this method actually gets called? Have you a theory on why 
you're overriding a possible setting of the default style, instead of just 
doing the setting yourself?

        — F

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to