April 2015
Intermediate to advanced
556 pages
17h 47m
English
Three mouse event methods were not discussed in Chapter 18: mouseMoved(_:), mouseEntered(_:), and mouseExited(_:).
To receive mouseMoved(_:),
the view’s window needs to accept mouse moved events.
If it does, the mouseMoved(_:) message
is sent to the window’s first responder.
To set the window to get mouse moved events,
set the acceptsMouseMovedEvents property
to true:
window?.acceptsMouseMovedEvents = true
At this point, the view will be sent the message every time the mouse moves. This is a lot of events. When people ask about mouse moved events, we ask them why they want it. They usually say, “Uh, rollovers.”
Rollovers are very popular with hyperlinks. As you roll over a region, its appearance ...
Read now
Unlock full access