Re: Overriding HTML translation in NSAttributedString
Re: Overriding HTML translation in NSAttributedString
- Subject: Re: Overriding HTML translation in NSAttributedString
- From: Nicko van Someren <email@hidden>
- Date: Fri, 11 Nov 2005 22:43:33 +0000
On 11 Nov 2005, at 22:01, Glen Simmons wrote:
I'm using NSAttributedString to get some XHTML into an NSTextView.
It's working well, but I need to tweak one thing. The XHTML has
some tags like this:
<img src="foo://bar.png" ...
The "foo:" scheme tells me that the image is actually part of my
internal data, not a file on disk. I'd like to step in at the point
when NSAttributedString is translating this into an
NSTextAttachment and supply the image, rather than getting the
little blue square with question mark. Is there a good way to do this?
Presumably you can create a subclass of NSURLProtocol which
implements the "foo:" protocol. Make its +initialize call
+registerClass: to hook it into the URL handling system and, I would
guess, WebKit will make use of it for the "foo:" URLs. You could
then just return the image data based on the leaf name given.
Nicko
_______________________________________________
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