Contents

addToolTip(_:owner:userData:)

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

Declaration

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

Parameters

  • rect:

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

  • owner:

    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.

  • data:

    Any additional information you want to pass to View:stringfortooltip:point:userdata:; it isn’t used if owner doesn’t implement this method.

Return Value

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

Discussion

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

See Also

Providing a Tool Tip