Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa: NSView origin x at the bottom

Tags:

cocoa

I am programmatically creating a NSWindow and the controls on it.

It seems the origin (0,0) is at the lower left corner. This is strange to me (coming from other GUI toolkits). Is there some flag or so so that I can change this so that the origin is in the left top corner?

like image 352
Albert Avatar asked Sep 13 '12 14:09

Albert


1 Answers

On OS X the origin is at the lower left corner. That's true for screen coordinates and view frames. You can override isFlipped: in an NSView subclass and return YES to make the upper left corner the origin of that view, but I don't think there is a way to do the same for screen coordinates.

like image 67
DrummerB Avatar answered Oct 31 '22 14:10

DrummerB