Graphics Programs Reference
In-Depth Information
At the top of
DetailViewController.m
, import the header for this new table view
controller.
#import "DetailViewController.h"
#import "AssetTypePicker.h"
Implement
showAssetTypePicker:
in
DetailViewController.m
.
- (IBAction)showAssetTypePicker:(id)sender
{
[[self view] endEditing:YES];
AssetTypePicker *assetTypePicker = [[AssetTypePicker alloc] init];
[assetTypePicker setItem:item];
[[self navigationController] pushViewController:assetTypePicker
animated:YES];
}
And finally, update the title of the button to show the asset type of a
BNRItem
. In
De-
tailViewController.m
, add the following code to
viewWillAppear:
.
if (imageKey) {
// Get image for image key from image cache
UIImage *imageToDisplay = [[BNRImageStore sharedStore]
imageForKey:imageKey];
// Use that imge to put on the screen in imageView
[imageView setImage:imageToDisplay];
} else {
// clear the imageView
[imageView setImage:nil];
}
NSString *typeLabel = [[item assetType] valueForKey:@"label"];
if (!typeLabel)
typeLabel = @"None";
[assetTypeButton setTitle:[NSString stringWithFormat:@"Type: %@", typeLabel]
forState:UIControlStateNormal];
}
Build and run the application. Select a
BNRItem
and set its asset type.