18 Mouse Events
In the previous chapter, you learned to use drawing commands to make a read-only view. A more useful view would be able to accept user input, and what better place to start than handling mouse events?
NSResponder
NSView inherits from NSResponder. All the event-handling methods are declared in NSResponder. We will discuss keyboard events in the next chapter. For now, we will focus on mouse events. NSResponder declares these methods:
func mouseDown(theEvent: NSEvent) func rightMouseDown(theEvent: NSEvent) func otherMouseDown(theEvent: NSEvent) func mouseUp(theEvent: ...
Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.