title: Mac Window Won't Let Me Resize to Smaller, possibly constraints?
body: <p>I'm not positive about what is going wrong, but my guess is that it is constraints related.</p>
  
  <p>When I try to resize my NSWindow, I'm able to make it larger without a problem. However, when I try to make it smaller, the window won't change size at all. Very few elements in the window have constraints with fixed sizes. The total fixed width is only about 120 and my window is about 700 wide, so I'm not running into a fixed width problem. In fact, if I drag the window to 800 wide, then it's min size becomes 800.</p>
  
  <p>My guess is that once the views have increased in size they don't want to compress back down. But that's just a guess.</p>
  
  <p>Any idea how to address this? Sorry that I can't provide any code, but I don't have any code involved. It's all just constraints in my xib.</p>
  
  <p>EDIT: </p>
  
  <p>I added an NSLog of <code>[self.window.contentView constraintsAffectingLayoutForOrientation:NSLayoutConstraintOrientationHorizontal]</code> to <code>- (void)windowDidResize:(NSNotification *)notification</code>. At first the window lets me resize it larger and smaller, and this is what the output looks like:</p>
  
  <pre><code>2015-03-20 17:41:40.097 10bii Financial Calculator[19780:561394] windowDidResize Constraints: (
      "&lt;NSAutoresizingMaskLayoutConstraint:0x600000081d10 h=-&amp;- v=-&amp;- H:|-(0)-[NSView:0x618000121400]   (Names: '|':NSThemeFrame:0x100902d90'10bii Financial Calculator' )&gt;",
      "&lt;NSAutoresizingMaskLayoutConstraint:0x600000081d60 h=-&amp;- v=-&amp;- H:[NSView:0x618000121400]-(0)-|   (Names: '|':NSThemeFrame:0x100902d90'10bii Financial Calculator' )&gt;",
      "&lt;NSLayoutConstraint:0x6180000856e0 'NSWindow-current-width' H:[NSThemeFrame:0x100902d90'10bii Financial Calculator'(872@500)] priority:500&gt;"
  )
  </code></pre>
  
  <p>Then, after a few resizes, the window stops allowing me to make it smaller and this is the output of the constraints log:</p>
  
  <pre><code>2015-03-20 17:42:03.506 10bii Financial Calculator[19780:561394] windowDidResize Constraints: (
      "&lt;NSAutoresizingMaskLayoutConstraint:0x600000081d10 h=-&amp;- v=-&amp;- H:|-(0)-[NSView:0x618000121400]   (Names: '|':NSThemeFrame:0x100902d90'10bii Financial Calculator' )&gt;",
      "&lt;NSLayoutConstraint:0x60800008d570 H:|-(0)-[ViewWithBackground:0x608000142c00]   (Names: '|':NSView:0x618000121400 )&gt;",
      "&lt;NSLayoutConstraint:0x60800008d520 H:[ViewWithBackground:0x608000142c00]-(0)-|   (Names: '|':NSView:0x618000121400 )&gt;",
      "&lt;NSLayoutConstraint:0x6080000829e0 H:[NSTextField:0x608000180dd0]-(20)-[NSTextField:0x608000180d00]&gt;",
      "&lt;NSLayoutConstraint:0x608000082940 NSTextField:0x608000180dd0.width == 3*NSTextField:0x608000180d00.width&gt;",
      "&lt;NSLayoutConstraint:0x608000082850 NSTextField:0x608000180dd0.width == 3*NSTextField:0x608000180c30.width&gt;",
      "&lt;NSLayoutConstraint:0x608000082800 NSTextField:0x608000180dd0.width == 3*NSTextField:0x608000180b60.width&gt;",
      "&lt;NSLayoutConstraint:0x6080000827b0 NSTextField:0x608000180dd0.width == 3*NSTextField:0x608000180a90.width&gt;",
      "&lt;NSLayoutConstraint:0x608000082ad0 H:[NSTextField:0x608000180d00]-(20)-[NSTextField:0x608000180c30]&gt;",
      "&lt;NSLayoutConstraint:0x6080000828f0 NSTextField:0x608000180dd0.width == 3*NSTextField:0x6080001809c0.width&gt;",
      "&lt;NSLayoutConstraint:0x608000082b70 H:[NSTextField:0x608000180c30]-(20)-[NSTextField:0x608000180b60]&gt;",
      "&lt;NSLayoutConstraint:0x6080000828a0 NSTextField:0x608000180dd0.width == 2*NSTextField:0x6080001808f0.width
  + 3&gt;",
      "&lt;NSLayoutConstraint:0x608000082c10 H:[NSTextField:0x608000180b60]-(20)-[NSTextField:0x608000180a90]&gt;",
      "&lt;NSLayoutConstraint:0x608000082cb0 H:[NSTextField:0x608000180a90]-(20)-[NSTextField:0x6080001809c0]&gt;",
      "&lt;NSLayoutConstraint:0x608000082d00 H:[NSTextField:0x6080001809c0]-(20)-[NSTextField:0x6080001808f0]&gt;",
      "&lt;NSLayoutConstraint:0x60800008d110 H:|-(20)-[NSTextField:0x608000180dd0]   (Names: '|':ViewWithBackground:0x608000142c00 )&gt;",
      "&lt;NSLayoutConstraint:0x60800008d340 H:[NSTextField:0x6080001808f0]-(20)-|   (Names: '|':ViewWithBackground:0x608000142c00 )&gt;" )
  </code></pre>
  
  <p>Here is what the window looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/Jie0X.png" alt="enter image description here"></p>