Restoring saved fileWrapper items problem
Restoring saved fileWrapper items problem
- Subject: Restoring saved fileWrapper items problem
- From: Peter Teeson <email@hidden>
- Date: Mon, 13 May 2013 11:58:30 -0400
MacOS 10.7.5 Lion Xcode 4.6.2
My single window NSDocument app has 2 NSImages each in their own instances of my sub-classed NSImageView.
It also has some colour wells and text labels. There are other objets I intend to add later.
I override - (NSFileWrapper *)fileWrapperOfType:(NSString *)typeName error:(NSError *__autoreleasing *)outError
and successfully save just the 2 images.
Note: I am not saving anything else in the document. My thinking was why bother to duplicate what is already in the nib.
To read the images back in again I have overridden -(BOOL)readFromFileWrapper:(NSFileWrapper *)fileWrapper ofType:(NSString *)typeName error:(NSError *__autoreleasing *)outError
Although I specifically set each NSImage it doesn't work because the problem seems to be that my 2 NSImageViews have not been instantiated. (Neither have the other objects for that matter.)
Looking at the debugger frame list I see that makeDocumentWithContentsOfURL:ofType:error is called.
I do actually get a new correctly titled window but it has the default images I would get if I had done New from the File menu.
So it seems to me that I could makeUntitledDocumentOfType:error the nib and then set the images. (then set the window title)
But my thinking is probably wrong so please contribute to my education with your valuable suggestions.
TIA
Peter
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden