how to move NSWindow to a particular screen?

房东的猫 提交于 2019-11-29 21:41:51

问题


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!


回答1:


[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 visibleFrame and change the frame of your window to go inside it.



来源:https://stackoverflow.com/questions/16658582/how-to-move-nswindow-to-a-particular-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!