Graphics Programs Reference
In-Depth Information
if ([indexPath row] == 0) {
// Put the title of the channel in row 0
[[cell textLabel] setText:@"Title"];
[[cell detailTextLabel] setText:[channel title]];
} else {
// Put the description of the channel in row 1
[[cell textLabel] setText:@"Info"];
[[cell detailTextLabel] setText:[channel infoString]];
}
return cell;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)io
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
return YES;
return io == UIInterfaceOrientationPortrait;
}
@end
Then implement the method from the ListViewControllerDelegate protocol in
the same file.
- (void)listViewController:(ListViewController *)lvc handleObject:(id)object
{
// Make sure the ListViewController gave us the right object
if (![object isKindOfClass:[RSSChannel class]])
return;
channel = object;
[[self tableView] reloadData];
}
Now you need to show this view controller and get the channel object to it. In
ListViewController.m , add a UIBarButtonItem to the ListViewControl-
ler 's navigationItem .
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
UIBarButtonItem *bbi =
[[UIBarButtonItem alloc] initWithTitle:@"Info"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(showInfo:)];
[[self navigationItem] setRightBarButtonItem:bbi];
[self fetchEntries];
}
return self;
}
Search WWH ::




Custom Search