title: Resizing NSWindow to fit new NSViews results in views being drawn incorrectly
body: <p>I have a NSWindowController with a setCurrentView method in which I use the following code to resize the window to the new view's size. </p>
  
  <pre><code>[self resizeWindowForContentSize: [newView frame].size];
  
  NSView *contentView = [[self window] contentView];
  NSDictionary *ani = [NSDictionary dictionaryWithObject:transition 
                                                  forKey:@"subviews"];
  [contentView setAnimations:ani];    
  [[contentView animator] replaceSubview:currentView with:newView];
  </code></pre>
  
  <p>Edit: Added the resizeWindowForContentSize I found on <a href="http://www.cocoadev.com/index.pl?WhereIsCoolSystemPrefsWindowEffect">CocoaDev</a>.</p>
  
  <pre><code>- (void)resizeWindowForContentSize:(NSSize) size {
      NSRect windowFrame = [NSWindow contentRectForFrameRect:[[self window] frame]
          styleMask:[[self window] styleMask]];
      NSRect newWindowFrame = [NSWindow frameRectForContentRect: 
          NSMakeRect( NSMinX( windowFrame ), NSMaxY( windowFrame ) - size.height, size.width, size.height )
      styleMask:[[self window] styleMask]];
      [[self window] setFrame:newWindowFrame display:YES animate:[[self window] isVisible]];
  }
  </code></pre>
  
  <p>The problem I'm having is that as you switch between views (using NSToolbar) the views begin to move around in the contentView.  Over time they actually draw further and further away until eventually there is just a blank view.</p>