0


i have created a custom NSView that displays an image.
i have created a property in Inspector view with binding to File's Owner.

Everything works fine in runtime image changing. But nothing is loaded when i save and load xib file.

here is the simplified code:

IBDocument *document = [IBDocument documentForObject:self];
[self->defaultImage release];
self->defaultImage = [document documentImageNamed:aImage];
[self->defaultImage setName:aImage];
[self->defaultImage retain];

The [document documentImageNamed:aImage] returns an NSImage in runtime, but when loading from file it return nil

though the NSImageWell works fine in runtime and when initialized from coder.

What i'm missing?

Thans.

Remizorrr
  • 2,322
  • 1
  • 17
  • 25

1 Answers1

0

You must implement NSCoding protocol for you custom object. http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Protocols/NSCoding_Protocol/Reference/Reference.html

user427179
  • 83
  • 1
  • 6