0

I am working on a cocoa project, utilizing auto layout. I let Xcode automatically pick the constrains for me.

When I simulate the document, it looks good, the controls adjust accordingly with the window.

When I run the project, the controls stay in a static position and the window moves around it causing the controls to become hidden, see image below.

Controls Cut Off

In my AppDelegate.m, all I have is this code:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    self.masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
    [self.window.contentView addSubview:self.masterViewController.view];
    self.masterViewController.view.frame = ((NSView*)self.window.contentView).bounds;
}

There is a MainMenu.xib that I haven't touched. The issue I am experiencing is with the MasterViewController.

I can't seem to figure out how to make the controls adjust with window resize...

This is my first cocoa project =)

Any help would be appreciated. Thanks!

M Jesse
  • 2,213
  • 6
  • 31
  • 37
  • You need to adjust the constraints accordingly to tell the auto layout system what you want - it's not a precog :-) Explaining the whole constraints system in a single response won't work, that's what Apple's docs are for.. – cacau May 21 '14 at 06:03
  • But re-sizing when simulating the document works fine, the controls adjust accordingly. So I thought that would show me how it would run. However I think the issue might be in the parent window... – M Jesse May 21 '14 at 13:06
  • I have a Window with a custom View Controller in it. When I resize the window, the view controller gets hidden by the new dimensions of the Window. – M Jesse May 22 '14 at 04:18
  • It feels like we'd need to see the constraints you've defined for the constraints across the window (width, leading/trailing space and space between objects in the left-right orientation). – Fitter Man Apr 24 '15 at 19:25

0 Answers0