Binding a custom NSView: Does it demand creating an IBPlugin?

前端 未结 4 1122
闹比i
闹比i 2021-02-19 09:01

I have created a subclass of NSView to draw an image as a pattern:

@interface CePatternView : NSView
{
    NSImage*    image;
    id      observableObjectForImag         


        
4条回答
  •  长情又很酷
    2021-02-19 09:22

    Answer to title: No, you can bind a custom view without an IB plug-in (by doing it in code).
    Answer to question in question body: Yes, you do need an IB plug-in to expose the binding in IB.

    Your code doesn't run inside Interface Builder unless you put it into Interface Builder, and that exposeBinding: message is your code. Therefore, you need to put it into Interface Builder. That means writing an IB plug-in.

    Also, IB plug-ins are not the same as the old IB palettes. Plug-ins require IB 3 and are much easier to create. Palettes require IB 2 and were painful to create.

提交回复
热议问题