In my app I need to be able to move my app's windows between the screens programmatically. I'm working on my MacBookPro and I'm connected to DELL monitor. So what I want to do is to have a method that would move my app's window from my laptop screen to the external DELL one.
Does anyone know how to achieve it?
Any help is highly appreciated!
[NSScreen screens]
gives you an array of NSScreens. The screen at index 0 is the one that's got your menu on.
So pick the other screen from the array, find it's 'visibleRect' and change the frame of your window to go inside it.
来源:https://stackoverflow.com/questions/16658582/how-to-move-nswindow-to-a-particular-screen