O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

For the More Curious: Rollovers

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:

w​i​n​d​o​w​?​.​a​c​c​e​p​t​s​M​o​u​s​e​M​o​v​e​d​E​v​e​n​t​s​ ​=​ ​t​r​u​e​

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required