Skip to content

Instantly share code, notes, and snippets.

@semireg
Created February 19, 2014 20:33
Show Gist options
  • Select an option

  • Save semireg/9100885 to your computer and use it in GitHub Desktop.

Select an option

Save semireg/9100885 to your computer and use it in GitHub Desktop.
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSView *contentView = self.window.contentView;
contentView.SE_nametag = @"Content View";
NSView *sidebarView = [[NSView alloc] init];
sidebarView.SE_backgroundColor = [NSColor greenColor];
PREPCONSTRAINTS(sidebarView);
sidebarView.SE_nametag = @"Sidebar View";
[contentView addSubview:sidebarView];
NSView *emptyView = [[NSView alloc] init];
emptyView.SE_backgroundColor = [NSColor orangeColor];
PREPCONSTRAINTS(emptyView);
emptyView.SE_nametag = @"Empty View";
[contentView addSubview:emptyView];
StretchViewV(sidebarView, 5, 1000);
StretchViewV(emptyView, 5, 1000);
// StretchVerticallyToSuperview(sidebarView, 5, 1000);
// StretchVerticallyToSuperview(emptyView, 5, 1000);
SizeViewH(sidebarView, 200, 1000);
ConstrainMinimumSize(sidebarView, CGSizeMake(200, 200), 1000);
ConstrainMinimumSize(emptyView, CGSizeMake(200, 200), 1000);
// CONSTRAIN_WIDTH(sidebarView, 200);
// CONSTRAIN_MIN_WIDTH(emptyView, 200, 1000);
//
// CONSTRAIN_MIN_HEIGHT(sidebarView, 200, 1000);
// CONSTRAIN_MIN_HEIGHT(emptyView, 200, 1000);
ConstrainViews(@"H:|-5-[view1]-10-[view2]-5-|", sidebarView, emptyView, 1000);
// ALIGN_LEADING(sidebarView, 5);
// [CONSTRAINT_STACKING_H(sidebarView, emptyView, 10) SE_install];
// ALIGN_TRAILING(emptyView, 5);
// NSLog(@"%@", [contentView viewLayoutDescription]);
// NSLog(@"%@", [sidebarView viewLayoutDescription]);
// NSLog(@"%@", [emptyView viewLayoutDescription]);
[self.window visualizeConstraints:[contentView constraints]];
// [contentView exerciseAmbiguityInLayout];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment