Euro 2008 and the challenge application on the end of chapter 18 have slowed me down, so only some notes about these two chapters this time.
Chapter 17, Custom Views.
This chapter deals about manipulating views (forms) manually. You can compare it with the .net System.Drawing namespace and subclassing the Control class to create your own controls. It also explains the alignment and docking of controls. Pretty basic stuff.
Chapter 18, Images and Mouse Events.
With the new knowledge on how to draw on views we now will allow the user to interact with the form and allow him to draw figures. This is done by handling mouse events. Also the file open dialog is introduced, but it’s called a NSOpenPanel here, to add images on the view.
The challenge application invites the reader to further customize the application, which draws rectangles when you complete the chapter, to draw ovals, adding undo redo capabilities and implementing archiving.
Most of the time I spend finding out how to hook up the document window to the custom view which handled the drawing of the ovals, as always key-value coding saved the day. You should also watch out that when a document is unarchived this is done before UI controls, I mean views :), are created. So don’t start assigning your saved ovals to a view that does not exist yet, like I did. It’ll save you time.
As always, you can get the book here .