• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
initWithURL/NSattributedStrings and NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

initWithURL/NSattributedStrings and NSData


  • Subject: initWithURL/NSattributedStrings and NSData
  • From: Darin Duphorne <email@hidden>
  • Date: Mon, 28 Jan 2002 23:56:05 -0600

I render html in a NSTextView as follows:

NSAttributedString *attrStr=[[NSAttributedString alloc] initWithURL:
fileURL documentAttributes:&attributes];
[[displayView textStorage] setAttributedString:attrStr];

This renders the html beautifully in a NSTextView. I can make modifications,
etc. I try to recover the html into a second view as follows:

NSData *htmlData=[NSArchiver archivedDataWithRootObject:displayView];
htmlString=[[NSString alloc] initWithData:htmlData encoding:NSASCIIStringEncoding]
;
[htmlView setString:htmlString];

However, the resulting text displayed is some sort of textual representation of the NSData (a portion is below). Are there any methods that will convert this to html?

 typedstreamh@NSTextTemplateFNSViewTemplate.NSView) NSResponder
NSObjecti @@@@ffffffff NSMutableSetNSSetIRNSString
+NSTypedFilenamesPboardType:png!NSTypedFilenamesPboardType:'TPIC'
NSTypedFilenamesPboardType:PCTNSTypedFilenamesPboardType:ICONSTypedFilenamesPboardType:
pict!NSTypedFilenamesPboardType:'PDF *
*
*
*
dFilenamesPboardType:'PICT'NSTypedFilenamesPboardType:icnsOV
OVNSText
NSMutableDataNSDataQ[337c]rtfd.TXT.rtf+~
#TXT.rtf6v{\rtf1\mac\ansicpg10000\
cocoartf100
{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\
tx6160\tx6720

\f0\fs24 \cf0 This is a test sentence.}NSColorcff$O
V$O###########


  • Follow-Ups:
    • Re: initWithURL/NSattributedStrings and NSData
      • From: Stefan Jung <email@hidden>
  • Prev by Date: Re: VCARD NSPasteboard type
  • Next by Date: Re: Menu About to show notification
  • Previous by thread: Re: Tooltips in NSTableView
  • Next by thread: Re: initWithURL/NSattributedStrings and NSData
  • Index(es):
    • Date
    • Thread