views:

100

answers:

1

I have subclassed NSPersistentDocument class. I want to add an image to the document. I have an Image Well. How do I set it to a .jpg file?

A: 

Load the JPEG file and set the resulting NSImage in a property of your document, using property syntax (self.image = [[[NSImage alloc] initWithContentsOfFile:…] autorelease]). Meanwhile, in your nib, bind the image view's value binding to your document's image property.

Peter Hosey