Reputation: 5852
I am given a global Screen position (x,y), and I have multiple monitors plugged into my Mac computer, how do I in Xcode (Objective-c) figure out which monitor am on.
Basically I need to know which index in the NSScreen list I am on, or how do I retrieve the global monitor space (coordinate system that includes all monitors)?
Upvotes: 0
Views: 263
Reputation: 22717
Get the array of NSScreen
s, and iterate through it, testing NSPointInRect( myPt, [aScreen frame] )
.
You don't say where you're getting your global (x, y). Some OS APIs assume a global coordinate space whose origin is at the top left of the main screen, while I think Cocoa puts the origin at the bottom left.
Upvotes: 1