Once more, we will use a category to organize our program code. This time our category will be used for capturing and saving still images.
In Xcode, click on the file named
MainmMenu.xib
in the project navigator and add a button with the name Take Picture.We are going to use another category to extend the behavior of our
BTSWindowController
object. From the File menu, select New, and then select the File… option.Select the Mac OS X Cocoa Objective-C category template and click on the Next button.
For the Category, select Importer and for the Category on select BTSWindowController, then click on the Next button.
Click the Create button.
In the file named
BTSWindowController+Importer.h
, add the following program code to expose the interface to thetakePicture:
method:// The action method to capture an image - (IBAction) takePicture:(id) sender;
In the Assistant editor, connect the Take Picture button to the
takePicture:
method by right-clicking on...