title: Get NSView frame/bounds relative to screen on Mac OS X 10.6
body: <p>I need to get an NSView's frame/bounds relative to the screen. In other words I need the x and y coordinates to be the position on the screen not the position relative to it's superview.</p>
  
  <p>I've come up with the following solution based on comments.</p>
  
  <pre><code>NSRect frameRelativeToWindow = [self.view
      convertRect:self.view.bounds toView:nil
  ];
  #if MAC_OS_X_VERSION_MAX_ALLOWED &gt; MAC_OS_X_VERSION_10_6
  NSPoint pointRelativeToScreen = [self.view.window
      convertRectToScreen:frameRelativeToWindow
  ].origin;
  #else
  NSPoint pointRelativeToScreen = [self.view.window
      convertBaseToScreen:frameRelativeToWindow.origin
  ];
  #endif
  
  NSRect frame = self.view.frame;
  
  frame.origin.x = pointRelativeToScreen.x;
  frame.origin.y = pointRelativeToScreen.y;
  </code></pre>