Thanks for the Guide/Walkthrough, Here's what I have come up with from that:

    NSDictionary *tA = [textView typingAttributes];
    NSMutableDictionary *tAM = [tA mutableCopy];
    NSParagraphStyle *pS = [tAM objectForKey:NSParagraphStyleAttributeName];
    NSMutableParagraphStyle *pSM = [pS mutableCopy];
    [pSM setMinimumLineHeight:spacing];
    [pSM setMaximumLineHeight:spacing];
    [tAM setObject:pSM forKey:NSParagraphStyleAttributeName];
    [textView setTypingAttributes:tAM];
    [tAM release];
    [pSM release];

All of it seems ok in XCode but when I run it I get an error in the debugger 
saying 

 *** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: 
NSParagraphStyle)

It seems to be saying that the NSMutableParagraphStyle is empty. I'll take a 
look at Aaron's Book, Thanks. 


Josh




________________________________
From: Paul Sanders <p.sand...@alpinesoft.co.uk>
To: Graham Cox <graham....@bigpond.com>; Joshua Garnham 
<joshua.garn...@yahoo..co.uk>
Cc: Cocoa-Dev List <cocoa-dev@lists.apple.com>
Sent: Sat, 2 January, 2010 11:04:52
Subject: Re: Setting the Line Height/ Line Spacing in an NSTextView.

Well, I have to say Graham has a point there, and I'm not going 
to write your code for you, but what I do goes something like 
this:

1.  Get the current typing attributes from my NSTextView (as an 
NSDictionary)

2.  Make a mutable copy (as an NSMutableDictionary)

3.  Retrieve the current NSParagrahpStyle from the dictionary 
(using NSParagraphStyleAttributeName as a key)

4.  Make a mutable copy of that (as an NSMutableParagraphStyle)

5.  Adjust this as desired (refer to docs)

6.  Add it to the NSMutableDictionary (again with key 
NSParagraphStyleAttributeName)

7.  Pass the dictionary to NSTextView's setTypingAttributes 
method

8.  Release your mutable copies

You can do something similar (using NSFont and 
NSFontAttributeName) if you want to change the font (which might 
be what you're after, I'm not sure).

If none of this makes any sense to you, you need to do some 
background reading (it's not something you can do in 5 minutes) 
and then write youself a little test program.  Mine is called 
Cocoa Testbench, and it taught me a lot.

As an aside, I remember when I first started learning Cocoa how 
tiring I found it, mentally (I am not the youngest of spring 
chickens).  There is a lot to know.  I think it's Hillegass who 
recommends getting plenty of sleep.  His book "Cocoa Programming 
for Mac OS X" might be worth buying (that will be $5 please 
Aaron :).

Paul Sanders

----- Original Message ----- 
From: "Graham Cox" <graham....@bigpond.com>
To: "Joshua Garnham" <joshua.garn...@yahoo.co.uk>
Cc: "Cocoa-Dev List" <cocoa-dev@lists.apple.com>
Sent: Saturday, January 02, 2010 10:13 AM
Subject: Re: Setting the Line Height/ Line Spacing in an 
NSTextView.



On 02/01/2010, at 6:57 PM, Joshua Garnham wrote:

> How would I use that?


RTFM:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextArchitecture/TextArchitecture.pdf

--Graham


_______________________________________________

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/p.sanders%40alpinesoft.co.uk

This email sent to p.sand...@alpinesoft.co.uk 



_______________________________________________

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