NSSplitView: how not to resize the window, but only "manually"?

I have a simple vertical one NSSplitView, and I won’t save my size when resizing windows, but I want to allow resizing NSSplitViewmanually when dragging a vertical strip separating the two views.

EDIT. This is the code I added, and for some reason everything goes wrong: the left pane (sourceView) remains the same size when the window is resized, but in the right pane, which has the correct layout restrictions (works fine without using the method below) , NSSrollView is the left panel in which I do not want to stay in the same position, and another image can be changed using the window.

- (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)subview
{
    if ([subview class] == [NSScrollView class])
        return NO;

    return YES;

}

Does anyone know a quick fix for this? Thank!

+5
3

Xcode 4.6 NSScrollView.

@synthesize leftView;

- (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)subview {
    if (subview == leftView) return NO;
    else return YES;
}
+6

split view

+1

NSSplitViewDelegate. , , NO -splitView:shouldAdjustSizeOfSubview:, .

Since you have at least 2 routines in each of splitView, you need to determine which one you do not want to move, so return NOonly for it and YESfor the view you want to change. For example, if you have a list of sources, and you want it to remain unchanged, except for manual manipulation, return NOfor the original list and YESfor the other side.

0
source

All Articles