Graphics Programs Reference
In-Depth Information
[items addObject:entry];
}
}
Build and run the application. You should see log statements in the console that indicate
the tree is being built. The last log statement in the console should have the correct data
for the channel object, which looks something like this:
<RSSChannel: 0x4e18f80>
forums.bignerdranch.com
Topics written by Big Nerd Ranch
Finally, we need to connect the channel and its items to the table view. In
ListViewController.m , import the header file for RSSItem and fill out the two
data source methods you temporarily implemented earlier.
#import "RSSItem.h"
@implementation ListViewController
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
return 0;
return [[channel items] count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
return nil;
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@"UITableViewCell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"UITableViewCell"];
}
RSSItem *item = [[channel items] objectAtIndex:[indexPath row]];
[[cell textLabel] setText:[item title]];
return cell;
}
Build and run the application. You should now see the titles of the last 20 posts in a table
view. Also, take a good look at the console to see the flow of the parser and how the del-
egate role is passed around.
 
Search WWH ::




Custom Search