0

For the life of me I cannot figure this out. I am working Xcode for Mountain Lion. I am having trouble adding NSView to an NSSplit View in my main NSWindow. My split view works as expected although when I add another view to it the view covers the bottom bar of my window this is not the behavior I want.

enter image description here

I have attached this photo to give an idea of what i'm dealing with. I understand that the origin (0,0) is the bottom left of any view although what I am wanting to happen is for the view to fill the split view and resize without having to manually resize the views ,and not overlap the bottom bar. Please any help would be great.

xMythicx
  • 827
  • 1
  • 11
  • 27
  • How are you adding this other view? Is there a reason why you can't use the custom view that's provided by default with the split view? – rdelmar Aug 10 '12 at 03:50
  • I am using the custom view provided by the split view. I get the effect above from adding subviews to the default split views. Sorry I should have been more clear. My mistake. The right most view is part of the split view with no subviews the left view and middle view are subviews I have added. The left most view does not have any autoresizing mask to it and the middle view has an auto resizing mask set to setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable witch gives me almost the desired behavior although it covers the bottom bar. – xMythicx Aug 10 '12 at 04:16

2 Answers2

0

A better pic of the application Should have uploaded it first. Sorry

enter image description here

xMythicx
  • 827
  • 1
  • 11
  • 27
0

I figured it out it seems the new dev library require you to use layout constraints. Here is my code if anyone is having the same problem.

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
     NSView * contentView = [window contentView];


    splitViewController = [[MainSplitViewController alloc]initWithNibName:@"MainSplitViewController" bundle:[NSBundle mainBundle]];

    NSView * subView = splitViewController.view;

    [subView setTranslatesAutoresizingMaskIntoConstraints:NO];

    [contentView addSubview:splitViewController.view];

     NSDictionary *views = NSDictionaryOfVariableBindings(subView);


    [contentView addConstraints:
     [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[subView]|"
                                             options:0
                                             metrics:nil
                                               views:views]];

    [contentView addConstraints:
     [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[subView]-32-|"
                                             options:0
                                             metrics:nil
                                               views:views]];






    [window setContentBorderThickness:32.0 forEdge:NSMinYEdge];
    [window autorecalculatesContentBorderThicknessForEdge:NSMinYEdge];

    // Insert code here to initialize your application
}
xMythicx
  • 827
  • 1
  • 11
  • 27