I am trying to create a horizontal NSSplitView
programmatically and to add it 2 subviews.
Unfortunately, if I have no issue to create the splitview, I do not know h
You add panes to a split view the same way you add subviews to any view. Each of the split view's subviews will get its own pane. You can use the adjustSubviews
method to automatically resize the views so that each pane is the same size.
This example code will create a split view which fills its window and has 3 text views split vertically.
NSSplitView *splitView = [[NSSplitView alloc] initWithFrame:[[theWindow contentView] bounds]];
NSTextView *textView1 = [NSTextView new];
NSTextView *textView2 = [NSTextView new];
NSTextView *textView3 = [NSTextView new];
[splitView addSubview:textView1];
[splitView addSubview:textView2];
[splitView addSubview:textView3];
[splitView adjustSubviews];
[[theWindow contentView] addSubview:splitView];
[textView3 release];
[textView2 release];
[textView1 release];
[splitView release];