Re: load a NIB from NSData
Re: load a NIB from NSData
- Subject: Re: load a NIB from NSData
- From: Itrat Khan <email@hidden>
- Date: Tue, 18 Jun 2002 16:11:42 -0400
On Wednesday, June 12, 2002, at 10:41 AM, Timothy Ritchey wrote:
I am trying to figure out if there is a way to load a NIB file that has
been loaded into an NSData object that I am passing over a DO
connection. The inelegant method would be to write the NSData object
out to a file, and then use the loadNibNamed:owner: selector on it. Any
ideas how I might just do it with the in-memory object? Is there a way
to treat an NSData object as a memory mapped file perhaps?
To treat a file as on object in memory, use NSFileWrapper. Give it the
path to your nib file using initWithPath: and ask for a
serializedRepresentation (an NSData object); send that NSData object to
a DO connection, and recreate the file wrapper on the other end using
initWithSerializedRepresentation:.
As for loading the nib, you may have to tell the DO's NSFileWrapper to
writeToFile: and then call loadNibNamed: on the result, which, by the
way, I don't see as being inelegant. :)
Regards,
Itrat.
............................................................
Modeless Software, Inc.
London, Ontario (Canada)
Tel: +1 519 473 2037
Web: www.modeless.com
_______________________________________________
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.