Graphics Programs Reference
In-Depth Information
{
}
The interface for
DetailViewController
now looks like this:
@interface DetailViewController : UIViewController
{
__weak IBOutlet UITextField *nameField;
__weak IBOutlet UITextField *serialNumberField;
__weak IBOutlet UITextField *valueField;
__weak IBOutlet UILabel *dateLabel;
__weak IBOutlet UIImageView *imageView;
}
@property (nonatomic, strong) BNRItem *item;
- (IBAction)takePicture:(id)sender;
@end
If you made any mistakes while making this connection and later realize it (or realize it
now), make sure you open
DetailViewController.xib
and disconnect any bad
connections. (Look for yellow warning signs in the connections inspector.)
Also, notice that
Xcode
is smart enough to tell you when an action method is connected in
the XIB file. See that little circle within a circle in the gutter area next to
takePic-
ture:
's method name (
Figure 12.7
)
? When this circle is filled in, this action method is
connected in a XIB file; an empty circle means it still needs connecting.
Figure 12.7 Source file connection status
In the
takePicture:
method, you will instantiate a
UIImagePickerController
and present it on the screen. When creating an instance of
UIImagePickerControl-
ler
, you must set its
sourceType
property and assign it a delegate.
The
sourceType
is a constant that tells the image picker where to get images. It has
three possible values: