RSS Feed in TableView


#1

I am trying to incorporate the project from this chapter into another project. My new project will do basically what the project in the book does except that the “Home” screen of the app has several buttons. Some of those buttons will point to different RSS feeds. I took the code from the book and put it into this new project and got a button to go to the table view when pressed but none of the articles from the RSS feed show up. It is just a blank table view. Everything showed up fine when I did the project in this chapter.

This is the method in KFBViewController (my Home screen) that tells the button what to do. The button works but the table view is blank:

  • (IBAction)gotoPublicAffairs
    {
    ListViewController *publicAffairs = [[ListViewController alloc] initWithNibName:nil bundle:nil];
    publicAffairs.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:publicAffairs animated:YES];
    }

#2

Here is where I set the root view. I think the problem has something to do with this.

#import “KFBAppDelegate.h”

#import “KFBViewController.h”
#import “ListViewController.h”
#import “WebViewController.h”

@implementation KFBAppDelegate

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.viewController = [[KFBViewController alloc] initWithNibName:@“KFBViewController” bundle:nil];
    ListViewController *lvc = [[ListViewController alloc]initWithStyle:UITableViewStylePlain];
    WebViewController *wvc = [[WebViewController alloc]init];
    [lvc setWebViewController:wvc];
    self.window.rootViewController = self.viewController;
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
    }

#3

It looks like tableView:cellForRowAtIndexPath: isn’t getting executed. I placed a breakpoint there and the app ran like it was never stopping at that point. Any ideas?


#4

If I change - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section to return 1; instead of return [[channel items]count]; then tableView:cellForRowAtIndexPath: gets called but obviously the table is still empty.


#5

I got the table view to show the articles from the RSS feed. Now I just have to figure out why I can’t select a row and have it go to the web view.


#6

I’m trying to do something similar; I was wondering if you could elaborate on how you fixed this problem. Specifically, how did you manage to get the “table view to show the articles from the RSS Feed”.

Any help would be appreciated!

Thanks! :slight_smile: