title: ShowWindow/HideWindow in Cocoa
body: <p>In Carbon you could change a window's visibility with HideWindow(WindowRef) and ShowWindow(WindowRef).</p>
  
  <p>In Cocoa I know you can call NSWindow's orderOut: to hide and orderFront:, orderBack: or orderWindow:relativeTo: to put it back on screen, but none of those respect the ordering of the window relative to other windows when it was last visible.</p>
  
  <p>For example, if I have two windows, one above the other, and then call orderOut: on the back window, how do I show the window again such that it is still behind the front window <strong>without calling orderWindow:relativeTo:</strong>.</p>
  
  <p>The only thing I can think of right now is to remember the window ID of the window immediately above it and then use orderWindow:relativeTo: when showing it again, but I haven't thought through what happens if the window above is closed before the rear window is made visible again.</p>