1
votes

I have an NSView subclass sized to fit a regular NSWindow window (right to the edges).

The view draws a background color, and when the app runs, it covers up the standard window resize control in the bottom right hand corner. You can still resize the window by dragging the corner.

If I resize my view so it doesn't quite go to the edge of the window, it's clear that the resize control is being drawn, but being overlapped by my view.

Anyone know of a way to fix this? Will I have to draw the resize control myself?

Here's a screenshot showing what I mean.

3
I've tried adding an NSImageView with the resize handle above my main view, but it still doesn't work. My main view is (and must be) layer backed, so maybe it ends up compositing over all other views for some reason.Zac

3 Answers

0
votes

You will either have to draw the grip yourself or knock out the lower-right corner of your background. Given that your view is flush with the edges of the window, I'd just draw it myself and be done with it.

Only trouble is I believe you'll have to handle drag-to-resize yourself if you do it this way (don't quote me, though). If so, you'll have to create an NSTrackingArea for that corner and handle drags in that area as window frame changes (size and origin).

0
votes

So I got it working by creating a layer with an image of the handle, and positioning it in the bottom right corner of the layer of the view. I don't have to implement the dragging myself - it just works.

0
votes

Use a backed layer versus a hosted layer. A hosted layer is typically for something really custom and applied to a borderless window in my experience.