I have a problem with positioning NSViews on screen from code inside my app.
Orientation system on Mac is like in math, so 0,0 is in bottom left corner.
So, if you want to position your View on top left corner, it frame origin should be 0,height_of_window/parentView
. Here starts my problems.
My window have size NSRect (x=0, y=0), (width=643, height=469)
I want to position my custom view in top left corner so I use:
NSRect rect = NSMakeRect(0, superviewRect.size.height, 329, 214);
to reach top of my screen but nothing shows up. The view is drawn outside windows' bounds. But when I aim with some smaller number like this:
NSRect rect = NSMakeRect(0, 200, 329, 214);
My View shows up like this:
And it is placed somewhere, not at the top but at least i can see it. How I can measure this top left corner from code to place it in the right place, when window got resized or similar case? I have Retina display, this is causing my bad calculations?
I hope you can understand what I menat!