开发者

Interface Builder Plugin Image inspector property problem on load

开发者 https://www.devze.com 2023-01-22 04:15 出处:网络
i have created a custom NSView that displays an image. i have created a property in Inspector view with binding to File\'s Owner.

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 ret开发者_如何学Pythonain];

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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号