April 2015
Intermediate to advanced
556 pages
17h 47m
English
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?
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: NSEvent) func rightMouseUp(theEvent: NSEvent) func otherMouseUp(theEvent: NSEvent) func mouseDragged(theEvent: NSEvent) func scrollWheel(theEvent: ...