O'Reilly logo

Beginning Mac OS® X Programming by Drew McCormack, Michael Trent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required