Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSSplitView: how to not resize with the window but only in "manual" way?

I' ve a simple vertical NSSplitView and I wan't that keeps his size when I resize the windows but I want to allow the resize of the NSSplitView manually when dragging the vertical bar that divides the two views.

EDIT. This is the code I' ve added and for some reason all goes wrong: the left pane (sourceView) keeps the same size while resizing the window but the right pane that has a correct auto layout constraints (works well without implementing the method below). The NSSrollView is the left pane that I wan' t to remain in the same position and the other view may resize with the window.

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

    return YES;

}

Anyone know a fast solution to do that? Thanks!

like image 864
Luca Avatar asked Mar 25 '13 19:03

Luca


2 Answers

In Xcode 4.6, The left custom view of the vertical split view is not NSScrollView.

@synthesize leftView;

- (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)subview {
    if (subview == leftView) return NO;
    else return YES;
}
like image 77
mii Avatar answered Nov 03 '22 00:11

mii


Try setting the split view item's behavior as Sidebar

like image 30
Ham Dong Kyun Avatar answered Nov 03 '22 01:11

Ham Dong Kyun