I had a problem with NSTextView refusing to use the text attributes I assigned to it. Here's my workaround in case anyone else runs into the same problem.
I configured an NSTextView in IB with a custom text color, a bit of dummy text with a custom font, and rich text turned off (i.e., it's plain text). The problem was that when the user deletes all the text, the text view reverts to black Helvetica 12. I googled "empty NSTextView site:cocoabuilder.com" and found some people had solved similar problems by writing a delegate method that futzes with the text view's typingAttributes. I was about to try that but noticed my text view's typingAttributes was nil. (The difference may be that the other people who had problems were using rich-text text views.) After a bunch of trial and error I got it to work by temporarily changing the rich-text flag to YES and selecting some non-empty text: [myTextView setRichText:YES]; [myTextView selectAll:nil]; // make sure text is non-empty //NSLog(@"typing attributes: %@", [myTextView typingAttributes]); [myTextView setRichText:NO]; It seems this forces the text view to set its typingAttributes, which it then dutifully applies in all subsequent editing. I'll file a Radar when I get home, but I'm posting here now in case someone can tell me it's a known issue and/or I'm Doing It Wrong. I have a vague feeling I'm missing something obvious. Well, I'm also posting so I can paste a URL to this thread in my code comments. :) --Andy _______________________________________________ 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