Re: NSTextView doesn't remember font when unarchived from nib?
Re: NSTextView doesn't remember font when unarchived from nib?
- Subject: Re: NSTextView doesn't remember font when unarchived from nib?
- From: Erik Buck <email@hidden>
- Date: Fri, 2 Jun 2006 19:42:04 -0400
If I set a font for an NSTextView in interface builder (multiple
fonts allowed is turned off), but leave the content blank, after
the nib is unarchived, I end up with the default font (Helvetica
12) instead of the one I set in IB.
Am I missing something? Or is this a known bug or limitation?
I think this is a know bug or omission. In my experience, a text
container with zero length has no range. All attributes including
font have to be applied to a range. If you try to apply attributes
to a zero range, the framework just ignores you like it is ignoring
IB when you tell IB to do that.
You are going to want to use the NSTextView method:
- (void)setTypingAttributes:(NSDictionary *)attrs;
after your nib is loaded.
I know of no way to get IB to set the font of an empty text view, but
I am happy to be informed of one.
The other thing you can do is put a single non-printable character in
you text view and then set the font attribute via IB. As long as the
range isn't zero, the attribute will stick.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden