LocalToGlobal

Converting from local coordinates to global coordinates the Cocoa way.

As a Macintosh programmer since the beginning, I still tend to think in Quickdraw. The Cocoa way of converting from local coordinates to global coordinates is:

NSPoint globalOrigin = [[self window] convertBaseToScreen: NSMakePoint(0, 0)];

Where "self" above is a view, and I'm coverting from a window relative 0,0 to the global bottom left of the window.

Cocoa Fragments

Page last modified July 4, 2006