NSSplityViewの3つのエリアをドラッグ連動してコントロールのサイズを調整します.


上編の2段階連動nssplitに基づいて一つのバージョンをアップグレードし、二つのnssplityviewを使用します.
その中で一番上と一番下の二つの領域の大きさは線を引くと動的に小さいコードを調整すれば実現できますが、中間は比較的複雑で、直接コードを見ます.
ソースのダウンロード:http://download.csdn.net/detail/bjbs_270/6455529
//
//  AppDelegate.h
//  Cocoa_splitview_v2

#import <Cocoa/Cocoa.h>

@interface AppDelegate : NSObject <NSApplicationDelegate,NSSplitViewDelegate>

@property (assign) IBOutlet NSWindow *window;

@property (assign) IBOutlet NSSplitView *splitOuter;
@property (assign) IBOutlet NSSplitView *splitInner;
@property (assign) IBOutlet NSTableView *leftTableView;
@property (assign) IBOutlet NSTableView *rightTableView;

@property (assign) IBOutlet NSTextView *textViewConsole;
@property (assign) IBOutlet NSTableView *tableViewProgress;

@end
//
//  AppDelegate.m
//  Cocoa_splitview_v2

#import "AppDelegate.h"

@implementation AppDelegate

- (void) awakeFromNib
{
    NSSize leftTableViewSize = [self.leftTableView frame].size;
    NSLog(@"---left table view: w:%f,h:%f",leftTableViewSize.width,leftTableViewSize.height);
    
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application
}


- (void) splitViewDidResizeSubviews:(NSNotification *)notification
{
    
    NSSplitView *split = [notification object];
    NSString *splitName = [split identifier];
    
//    NSLog(@"split name is %@",[split identifier]);
    
    NSArray *allviews = [split subviews];
    
    if ([splitName isEqualToString:@"split_outer"]) {
        //1.
        NSView *topView = [allviews objectAtIndex:0];
        [[self.textViewConsole enclosingScrollView] setFrame:[topView frame]];
        
        NSView *bottomView = [allviews objectAtIndex:2];
        NSSize bottomSize = [bottomView frame].size;
        NSRect bottomRect = {0,0,bottomSize.width,bottomSize.height};
        [[self.tableViewProgress enclosingScrollView] setFrame:bottomRect];
        
        //2.
        NSView *middleView = [allviews objectAtIndex:1];
        NSRect middleRect = [middleView frame];
        
        NSLog(@"x:%f,y:%f,w:%f,h:%f",middleRect.origin.x,middleRect.origin.y,middleRect.size.width,middleRect.size.height);
        
        //3.                     
        NSPoint point = NSMakePoint(0, 0);
        [self.splitInner setFrameOrigin:point];
        [self.splitInner setFrameSize:middleRect.size];
        
        NSArray *innerSubViews = [self.splitInner subviews];
        
        NSView *leftTableViewOuterView = [innerSubViews objectAtIndex:0];
        NSSize leftTableViewOuterViewSize = [leftTableViewOuterView frame].size;
        [[self.leftTableView enclosingScrollView] setFrameSize:leftTableViewOuterViewSize];
        [[self.leftTableView enclosingScrollView] setFrameOrigin:point];
        
        NSView *rightTableViewOuterView = [innerSubViews objectAtIndex:1];
        NSSize rightTableViewOuterViewSize = [rightTableViewOuterView frame].size;
        [[self.rightTableView enclosingScrollView] setFrameSize:rightTableViewOuterViewSize];
        [[self.rightTableView enclosingScrollView] setFrameOrigin:point];
        
    } else if([splitName isEqualToString:@"split_inner"]){
        NSLog(@"xxxxxxx");//TODO
    }
}

@end