Post

Replies

Boosts

Views

Activity

How to create a window outside the screen
I am studying MAC OS development and I used Swift and Cocoa to create a window that I want to display outside the screen. My code looks like this: @IBAction func tapShowSplitWindow(_ sender: Any) { let initRect = NSRect(x: -100, y: -100, width: 300.0, height: 300.0) var window = NSWindow(contentRect: initRect,styleMask: .titled, backing: .buffered, defer: false) window.contentView = NSView() window.contentView?.wantsLayer = true window.contentView?.layer?.backgroundColor = NSColor.red.cgColor window.makeKeyAndOrderFront(self) } The window will appear in the bottom left corner of the screen, and I expect it to be outside the screen. so why? and how to show it outside
2
1
802
May ’22