Akki
Akki

Reputation: 1477

How to change resizing areas of a custom shaped NSWindow

In my macOS app, I created a custom shaped window which visible frame is less than actual. I want to make invisible areas inactive for user interactions. I've played with NSWindow's frameRect(forContentRect contentRect: NSRect) and other methods, tracking areas of it's contentView but achieve no success. Is it possible or I'm just wasting time?

Upvotes: 1

Views: 257

Answers (1)

Daij-Djan
Daij-Djan

Reputation: 50129

the main thing to do

Making a custom window starts with a transparent window. => that makes OSX pass through clicks on non-opaque areas of the window

In your window subclass you gotta override init and set opaque to NO

further read

I could reiterate all from the old bbut good cocoawithlove tutorial bbut instead, ill link it: https://www.cocoawithlove.com/2008/12/drawing-custom-window-on-mac-os-x.html

Upvotes: 1

Related Questions