Re: coordinate system
Re: coordinate system
- Subject: Re: coordinate system
- From: Steve Bird <email@hidden>
- Date: Thu, 25 Oct 2001 01:23:59 -0400
On Wednesday, October 24, 2001, at 11:53 , Brian Luft wrote:
Does Cocoa use a geometry-style coordinate system with (0, 0) at the
lower left corner?
---Yes. I recall reading this, but I cannot quote you where. 0,0 is
lower left, +Y is up. Just like they taught you in fifth grade math.
Computer screens have always been "wrong", because the scan line moves
from top to bottom, video ram addresses increase from top to bottom, so
it seemed natural to number the coordinates from top to bottom. Cocoa
has finally "corrected" this.
How do I flip this?
Set the control's Y coordinate to (WindowHeight - ControlHeight - Y).
Or just change your thinking.
Also, why would the controls be stuck to the bottom of the window?
--- because the control's Y position is Y pixels from the bottom of the
window. If the window expands downward, the control moves downward.
Note that these controls were instanciated from another .nib and
dynamically added to the window, not statically added in interface
builder.
--- Immaterial. The coordinate system is the same.
-------------------------------------------------------------------------------------
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com (toll free) 1-877-676-8175