cocoa - HTML in textview -
How do I show HTML data in textview
You did not say whether you are targeting Mac or iPhone when I tag your question with cocoa, I agree I am
It's looking for an overview of how NSTextView works. But at the original level, all the NSTextView s contains an NSTextStorage object (accessible via textStorage method) NSTextStorage Should be a sub class of NSMutableAttributedString .
NSAttributedString is an initial name that will parse an HTML string for you. Once you have found it, you will see the resulting string in your NSTextView Code> textStorage . For example: get
NSData * htmlData = // html, e.g. The URL used to resolve the NSURL * aBaseURL = // related link from a file eg. '/directory/page.html' NSAttributedString * Formatted HTML = [[NSAttributedString alloc] initWithHTML: htmlData baseURL: aBaseURL Document Attributes: NULL]; [[MyTextView textstuff] Appendabridged string: HTML formatted]; [Formatted html release];
Comments
Post a Comment