Search code examples
objective-cxcodecocoabwtoolkit

Using BWToolkit programmatically


Xcode no longer supports ibplugins so I wonder if anyone has any experience using BWToolkit programmatically. Basically BWSplitView does everything I need (the introduction video on the website says it all) but I'm a bit lost on how to use the class.

Has anyone done it?


Solution

  • From looking at the BWToolkit there a few key things that I noticed.

    • BWSplitView is a subclass of NSSplitView. So it should have some methods similar (i.e init methods).

    • BWSplitView does have an init method that lets it be used as a
      singleton.

    So that being said (without trying any of this in Xcode), you should be able to create an instance of BWSplitView using it's super class, NSSplitView 's, init method. Then add it to your view.

    Here is an example (again, untested):

    BWSplitView *splitView = [[BWSplitView alloc] initWithFrame:[[theWindow contentView] bounds]];
    
    NSTextView *textView1 = [NSTextView new];
    NSTextView *textView2 = [NSTextView new];
    
    
    [splitView addSubview:textView1];
    [splitView addSubview:textView2];
    
    [splitView adjustSubviews];
    
    [[theWindow contentView] addSubview:splitView];
    
    [textView1 release];
    [textView2 release];
    

    You may have to write some of your accessor methods to BWSplitView private methods.

    Hope this helps.