Fw: Setting the Line Height/ Line Spacing in an NSTextView.
Fw: Setting the Line Height/ Line Spacing in an NSTextView.
- Subject: Fw: Setting the Line Height/ Line Spacing in an NSTextView.
- From: Joshua Garnham <email@hidden>
- Date: Thu, 31 Dec 2009 18:14:42 +0000 (GMT)
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 <email@hidden>
To: Joshua Garnham <email@hidden>
Cc: cocoa-dev List <email@hidden>
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 (email@hidden)
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:
This email sent to email@hidden