I have created a subclass of NSView to draw an image as a pattern:
@interface CePatternView : NSView
{
NSImage* image;
id observableObjectForImage;
NSString* keyPathForImage;
}
@end
I implemented the following to expose bindings:
+ (void)initialize
{
// Expose the "image" binding to IB.
[self exposeBinding:@"image"];
}
- (Class)valueClassForBinding:(NSString *)binding
{
if([binding isEqualToString:@"image"])
return [NSImage class];
return nil; // Unknown binding
}
Unfortunately, the image binding does not show up in Interface Builder.
Do I really have to create an IBPlugin to expose bindings in Interface Builder? That just seems way overkill for a custom view that I don't plan to reuse.