Initializes and returns an object defining a region of a view to receive mouse-tracking events, mouse-moved events, cursor-update events, or possibly all these events.
- macOS 10.5+
A rectangle that defines a region of a target view, in the view’s coordinate system, for tracking events related to mouse tracking and cursor updating. The specified rectangle should not exceed the view’s bounds rectangle.
One or more constants that specify the type of tracking area, the situations when the area is active, and special behaviors of the tracking area. See the description of
NSTrackingand related constants for details. You must specify one or more options for the initialized object for the type of tracking area and for when the tracking area is active; zero is not a valid value.
The object to receive the requested mouse-tracking, mouse-moved, or cursor-update messages. It does not necessarily have to be the view associated with the created
NSTrackingobject, but should be an object capable of responding to the
A dictionary containing arbitrary data for each mouse-entered, mouse-exited, and cursor-update event. When handling such an event you can obtain the dictionary by sending
NSEventobject. (The dictionary is not available for mouse-moved events.) This parameter may be
The newly-initialized tracking area object.
After creating and initializing an
NSTracking object with this method, you must add it to a target view using the
add method. When changes in the view require changes in the geometry of its tracking areas, the Application Kit invokes
update. The view should implement this method to replace the current
NSTracking object with one with a recomputed area.