我用这段代码修复了它:
- (void)splitViewDidResizeSubviews:(NSNotification *)notification
{
NSSplitView *splitView = (NSSplitView *)[notification object];
NSView *topSubview0 = (NSView *)[[topSplit subviews] objectAtIndex:0];
NSView *topSubview1 = (NSView *)[[topSplit subviews] objectAtIndex:1];
NSView *bottomSubview0 = (NSView *)[[bottomSplit subviews] objectAtIndex:0];
NSView *bottomSubview1 = (NSView *)[[bottomSplit subviews] objectAtIndex:1];
if (fabsf([bottomSubview0 frame].size.width - [topSubview0 frame].size.width) >= 1.0f)
{
if (splitView == topSplit)
{
NSLog(@"topSplit");
[bottomSubview0 setFrame:[topSubview0 frame]];
[bottomSubview1 setFrame:[topSubview1 frame]];
}
else
{
NSLog(@"bottomSplit");
[topSubview0 setFrame:[bottomSubview0 frame]];
[topSubview1 setFrame:[bottomSubview1 frame]];
}
}
}