title: How to close a view -- Xcode
body: <p>I created a window based on NSWindowController It is called with...</p>
  
  <pre><code>view2Controller = [[View2Controller alloc] initWithWindowNibName:@"View2"];
  [view2Controller showWindow:self];
  </code></pre>
  
  <p>That works great, and I have a functioning window.<br>
  Now I need to close it.</p>
  
  <pre><code>exit(0); // closes the entire application
  close(0); // does is in the documentation, but it nothing
  </code></pre>
  
  <p>I found a suggestion to use..</p>
  
  <pre><code>[self dismissModalViewControllerAnimated:YES];
  </code></pre>
  
  <p>, but that seems to apply only to UI views, and generates an error. </p>
  
  <p>How can I close the window that I have here?</p>