• 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
Re: initWithURL/NSattributedStrings and NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 @@@@ffffffff NSMutableSetNSSetIRNSString
+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.


References: 
 >initWithURL/NSattributedStrings and NSData (From: Darin Duphorne <email@hidden>)

  • Prev by Date: Universally available widgets
  • Next by Date: Re: theoretical idea - would this work?
  • Previous by thread: initWithURL/NSattributedStrings and NSData
  • Next by thread: NSKeyValueCoding tips
  • Index(es):
    • Date
    • Thread