8.14. Exercises

  1. Slide Master can display images as individual documents, as well as in a collection of slides in a slide show. Extend Slide Master to open an image in its own document when you double-click an entry in the slide show document's table view. Try to use NSDocumentController to open the requested file.

  2. Change the slide show document to print the name of the current slide in the main slide show window. Implement the feature by printing the name directly in the SlideImageView. No nib file changes should be necessary. AppKit provides some additions to Foundation's NSString class for drawing strings directly in a view; you may find these methods helpful.

  3. If the slide show document's image view is selected, you can delete the current slide simply by pressing the Delete key. However, if the table view is selected, the delete key simply beeps at you. Fix this bug by extending the table view to respond to the Delete key.

    Note that unlike with SlideImageView you can't actually forward the keyDown: event to your SlideShowWindowController using the responder chain. That's because the table view actually resides in a drawer window, which is separate from your slide show window and the SlideShowWindowController. Instead, try sending the keyDown: event to the table view's delegate object.

Get Beginning Mac OS® X Programming 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.