Graphics Programs Reference
In-Depth Information
The
DetailViewController
's
view
will appear at two times: when the user taps a
row in
ItemsViewController
and when the
UIImagePickerController
is
dismissed. In both of these situations, the
imageView
should be populated with the im-
age of the
BNRItem
being displayed. In
DetailViewController.m
, add code to
viewWillAppear:
to do this.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[nameField setText:[item itemName]];
[serialNumberField setText:[item serialNumber]];
[valueField setText:[NSString stringWithFormat:@"%d",
[item valueInDollars]]];
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init]
autorelease];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateLabel setText:
[dateFormatter stringFromDate:[item dateCreated]]];
NSString *imageKey = [item imageKey];
if (imageKey) {
// Get image for image key from image store
UIImage *imageToDisplay =
[[BNRImageStore sharedStore] imageForKey:imageKey];
// Use that image to put on the screen in imageView