November 2011
Intermediate to advanced
528 pages
10h 14m
English
In the previous chapter, you drew lines connecting random points. A more interesting project would have been to write a drawing application. To write this sort of application, you will need to be able to get and handle 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 are interested just in mouse events. NSResponder declares these methods:
- (void)mouseDown:(NSEvent *)theEvent;- (void)rightMouseDown:(NSEvent *)theEvent;- (void)otherMouseDown:(NSEvent *)theEvent;- (void)mouseUp:(NSEvent *)theEvent;- (void)rightMouseUp:(NSEvent *)theEvent;- (void)otherMouseUp:(NSEvent *)theEvent; ...
Read now
Unlock full access