How do I discover the size of the Desktop (or screen size) of the Mac?
For the screen size use -[NSScreen frame]
on an instance received through e.g. +[NSScreen mainScreen]
or -[NSWindow screen]
.
To get the visible part without the dock and menu bar, use -[NSScreen visibleFrame]
.
Keep in mind that the full desktop can stretch over multiple screens.
来源:https://stackoverflow.com/questions/4489290/how-to-get-mac-desktop-size