Graphics Programs Reference
In-Depth Information
animated:YES];
RSSItem *entry = [[channel items] objectAtIndex:[indexPath row]];
NSURL *url = [NSURL URLWithString:[entry link]];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
[[webViewController webView] loadRequest:req];
[[webViewController navigationItem] setTitle:[entry title]];
[webViewController listViewController:self handleObject:entry];
}
Build and run the application. The behavior of the application should remain the same, but
now we're sending a generalized message to the web view controller.
Now that WebViewController conforms to our protocol and implements the required
method, let's create the ChannelViewController class.
Create an NSObject subclass and name it ChannelViewController . In Chan-
nelViewController.h , change its superclass to UITableViewController ,
have it conform to the ListViewControllerDelegate protocol, and add an in-
stance variable for the RSSChannel object.
#import "ListViewController.h"
@class RSSChannel;
@interface ChannelViewController : NSObject
@interface ChannelViewController :
UITableViewController <ListViewControllerDelegate>
{
RSSChannel *channel;
}
@end
In ChannelViewController.m , implement the data source methods to display the
metadata in a table:
#import "RSSChannel.h"
@implementation ChannelViewController
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];
if (!cell)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2
reuseIdentifier:@"UITableViewCell"];
 
Search WWH ::




Custom Search