If you're targeting OS X 10.6+, then it's much easier to use NSSplitView
's splitView:shouldAdjustSizeOfSubview:
to control sizing.
One way to use this method would be to add the following IBOutlet
s to your .h file:
@property (nonatomic, weak) IBOutlet NSView *leftView;
@property (nonatomic, weak) IBOutlet NSView *centerView;
@property (nonatomic, weak) IBOutlet NSView *rightView;
Then implement splitView:shouldAdjustSizeOfSubview:
in your .m file like this:
- (BOOL)splitView:(NSSplitView *)aSplitView
shouldAdjustSizeOfSubview:(NSView *)subview {
return (subview == _centerView);
// or return !(subview == _leftView || subview == _rightView);
}
By implementing that, you basically say "only adjust the size of center subview when resizing".
You can comment out the entire splitView:resizeSubviewsWithOldSize:
method for the time being unless you need to customize the default behavior in some way.
Note that if you have multiple split views that have this controller object set to be their delegate, you may want to check to see which split view is being passed in the aSplitView
parameter and do different things accordingly.