Thanks, there is no immediate need to override so I will try calling it.

So would this work?…

CGFloat spacing = 5.0f;
NSMutablePargagraphStyle *paragraphStyle;
[paragraphStyle setLineSpacing:spacing];
[paragraphStyle setMinimumLineHeight:spacing];
[paragraphStyle setMaximumLineHeight:spacing];
[textView setDefaultParagraphStyle:paragraphStyle];

- Josh




________________________________
From: Fritz Anderson <fri...@manoverboard.org>
To: Joshua Garnham <joshua.garn...@yahoo.co.uk>
Cc: cocoa-dev List <cocoa-dev@lists.apple.com>
Sent: Wed, 30 December, 2009 17:24:21
Subject: Re: Setting the Line Height/ Line Spacing in an NSTextView.

On 30 Dec 2009, at 11:01 AM, Joshua Garnham wrote:

> But the methodssetLineSpacing: and others are NSMutableParagraphStyle methods 
> only. 

That's the point. You may _want_ to change the paragraph style's properties, 
but you can't. Casting the parameter doesn't turn an immutable object into a 
mutable one.

If you really want to substitute a paragraph style of your own (and please 
comment on the suggestions that you may not want to), make a mutableCopy, set 
that up as you wish, and pass it up to super.

You may be misconceiving the need to subclass in Cocoa. Subclassing is rare. 
Most modifications to object behaviors are done through delegates and property 
setters; Cocoa provides a lot of them. That's why you're getting told to _call_ 
setDefaultParagraphStyle:, not _override_ it. 

If you explained why you feel you must override, we might be better able to 
help you.

    — 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