Skip to content

Instantly share code, notes, and snippets.

@chamons

chamons/foo.m Secret

Last active Oct 3, 2016
Embed
What would you like to do?
#import "ViewController.h"
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSSplitView * splitView = [NSSplitView new];
splitView.identifier = @"ID_MySplitView";
splitView.autosaveName = @"MySplitView";
splitView.vertical = true;
splitView.dividerStyle = NSSplitViewDividerStyleThick;
splitView.delegate = self;
[splitView addSubview:[self makeColorView:[NSColor redColor]]];
[splitView addSubview:[self makeColorView:[NSColor blueColor]]];
[self.view addSubview:splitView];
splitView.frame = self.view.frame;
}
- (NSView*) makeColorView:(NSColor *)color
{
NSView * v = [NSView new];
v.wantsLayer = TRUE;
v.layer.backgroundColor = color.CGColor;
return v;
}
- (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)view NS_AVAILABLE_MAC(10_6)
{
return TRUE;
}
- (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
{
return TRUE;
}
- (BOOL)splitView:(NSSplitView *)splitView shouldCollapseSubview:(NSView *)subview forDoubleClickOnDividerAtIndex:(NSInteger)dividerIndex NS_AVAILABLE_MAC(10_5)
{
return TRUE;
}
- (void)setRepresentedObject:(id)representedObject {
[super setRepresentedObject:representedObject];
// Update the view, if already loaded.
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.