开发者

+exposeBinding not working

I'm trying to expose a 开发者_如何学Pythoncustom binding in an subclass of an NSWindowController. I added the following code to the subclass:

+(void)initialize { [self exposeBinding:@"customBinding"]; }

Then, in IB, I have an object instance of my subclass. But, when I look at the bindings of the custom NSWindowController, I don't see the 'customBinding' exposed. Am I missing something?


These methods are for use in legacy Interface Builder plug-ins only. Xcode 4 doesn't officially support plug-ins. You have create these bindings in code using -bind:toObject:withKeyPath:options:. The “type whatever you like” part only applies to the key paths you bind to, not to the binding names themselves.


These are only if you're creating an IB palette/plugin. From Cocoa Bindings Programming Topics:

The other methods—the class method exposeBinding: and the instance methods exposedBindings and valueClassForBinding:—are useful only in an Interface Builder palette.

When setting up bindings, you can just type in whatever key paths you like; they don't have to be exposed in IB.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜