Instance Method


Creates a tooltip for a defined area the view and returns a tag that identifies the tooltip rectangle.


func addToolTip(_ rect: NSRect, owner: Any, userData data: UnsafeMutableRawPointer?) -> NSView.ToolTipTag



A rectangle defining the region of the view to associate the tooltip with.


An object from which to obtain the tooltip string. The object should either implement view(_:stringForToolTip:point:userData:), or return a suitable string from its description method. (It can therefore simply be an NSString object.)


Any additional information you want to pass to view(_:stringForToolTip:point:userData:); it is not used if anObject does not implement this method.

Return Value

An integer tag identifying the tooltip; you can use this tag to remove the tooltip.


The tooltip string is obtained dynamically from anObject by invoking either the NSToolTipOwner informal protocol method view(_:stringForToolTip:point:userData:), if implemented, or the NSObjectProtocol protocol method description.

See Also


func removeAllToolTips()

Removes all tooltips assigned to the view.

func removeToolTip(NSView.ToolTipTag)

Removes the tooltip identified by specified tag.

var toolTip: String?

The text for the view’s tooltip.