Working with NSResponder
Understanding how the responder chain works is important when building your own views with event handling. In this recipe, you will learn about
NSResponder's three most important methods and the sequence in which they are called.
In Xcode, create a new Cocoa Application and name it
How to do it...
- In the Xcode project, right-click on the Classes folder and choose Add, then choose New File Under the MacOS X section, select Cocoa Class, then select Objective-C class. Finally, choose NSView in the Subclass of popup. Name the new file
- In Xcode, Add the following code to the
drawRect:method of the
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:[self ...