Re: initWithURL/NSattributedStrings and NSData
Re: initWithURL/NSattributedStrings and NSData
- Subject: Re: initWithURL/NSattributedStrings and NSData
- From: Stefan Jung <email@hidden>
- Date: Tue, 29 Jan 2002 10:17:37 +0100
You saved the file with NSArchiver, but you read it as raw NSData. Use
NSUnarchiver should work.
Stefan Jung
Am Dienstag den, 29. Januar 2002, um 06:56, schrieb Darin Duphorne:
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@@@@ffffffffNSMutableSetNSSetIRNSString
+NSTypedFilenamesPboardType:png!NSTypedFilenamesPboardType:'TPIC'
NSTypedFilenamesPboardType:PCTNSTypedFilenamesPboardType:ICO
NSTypedFilenamesPboardType:
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###########
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.