I'm trying to add a border to an NSWindow for a drag operation (in the same way that dragging into a Finder window puts a blue border around it). The problem I'm experiencing is that the border is drawn underneath all of the subviews in the window.
Note, in the interests of simplicity I've left out the code in MyWindowController, which calls draggingEntered, draggingExited and performDragOperation. I've also removed the code that removes the border - if the code as it stands is run then the window will always have a yellow border under the subviews because the problem that I need to solve is the layering rather than anything else.
@implementation MyWindowView
- (void)drawRect:(NSRect)dirtyRect {
[NSColor.yellowColor set]; // just for debug purposes because I don't use yellow for any other reason
NSBezierPath *path = [NSBezierPath bezierPathWithRect:self.bounds];
path.lineWidth = 10.0;
[path stroke];
}
@end
How do I need to implement this so that the border is drawn on top of the subviews?
MyWindowView
view in the view hierarchy?MyWindowView
the content view? Do you want to add a border to a view (code) or a window (title of the question)? How do I get a drop target indication on a Finder window?