Contents

hitTest(_:)

Returns the farthest descendant of the view in the view hierarchy (including itself) that contains a specified point, or nil if that point lies completely outside the view.

Declaration

func hitTest(_ point: NSPoint) -> NSView?

Parameters

  • point:

    A point that is in the coordinate system of the view’s superview, not of the view itself.

Return Value

A view object that is the farthest descendent of aPoint.

Discussion

This method is used primarily by an NSWindow object to determine which view should receive a mouse-down event. You’d rarely need to invoke this method, but you might want to override it to have a view object hide mouse-down events from its subviews. This method ignores hidden views.

See Also

Related Documentation

Handling Events in the View