0

I am writing a Cocoa application with multi monitor support. It has a window controller which loads a UI from a NIB file. I would like this window to appear on the secondary monitor rather than the primary one. Is it possible to achieve this programmatically ? Please note that it is not a full screen window, and the window does not have a menu bar.

  • I found this in 15 seconds: http://stackoverflow.com/questions/401240/display-os-x-window-full-screen-on-secondary-monitor-using-cocoa – trojanfoe Aug 21 '13 at 07:56
  • Thanks. I saw this before. What i want to display is not a full screen window. I'll try to create the rect manually with the required coordinates and see whether it's working. But there should be a better way of doing this :) – Champika Samarasinghe Aug 21 '13 at 08:08
  • Yes you'll need to use a different style mask and content rect, however it shows how to specify the screen the window should appear on. – trojanfoe Aug 21 '13 at 08:10
  • Managed to get it working to a certain extent by calculating the new origin coordinates and using setFrameOrigin method of the window. However, this calculation becomes increasingly difficult if the user has a display alignment like [this](http://imgur.com/qGudTuG). What i want is to center the window in the secondary monitor in all cases. is it possible to achieve this programmatically ? – Champika Samarasinghe Sep 11 '13 at 10:18

0 Answers0