I have a transparent NSView
on a transparent NSWindow
. The view\'s drawRect:
method draws some content (NSIma
You can override the hitTest
method in your NSView
so that it always returns itself.
According to the NSView documentation, the hitTest
method will either return the NSView that the user has clicked on, or nil
if the point is not inside the NSView
. In this case, I would invoke [super hitTest:]
, and then return the current view only if the result would otherwise be nil
(just in case your custom view contains subviews).
- (NSView *)hitTest:(NSPoint)aPoint
{
NSView * clickedView = [super hitTest:aPoint];
if (clickedView == nil)
{
clickedView = self;
}
return clickedView;
}