Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8787531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:54:51+00:00 2026-06-13T21:54:51+00:00

I have created a simple rss reader that populates the tableviewcell on viewdidLoad without

  • 0

I have created a simple rss reader that populates the tableviewcell on viewdidLoad without a problem. My problem is whenever I click my button the tableview doesn’t change. I tried reload with the button touchup inside and nothing still happens. Fairly new to Xcode and iOS programming so any help is great.

.m file

#import "ViewController.h"
#import "KMXMLParser.h"
#import "WebViewController.h"
#import "SportsViewController.h"

@interface ViewController ()
@end

@implementation ViewController
{
    NSArray *loadData;
    NSURL *thumbnails;
}

@synthesize parseResults=_parseResults;

- (void)viewDidLoad
{
    [super viewDidLoad];
    KMXMLParser *parser = [[KMXMLParser alloc]  initWithURL:@"http://www.daytonastate.edu/rss/it.xml" delegate:nil];

    _parseResults = [parser posts];
   [self refreshFeed];
        // Do any additional setup after loading the view, typically from a nib.
}

-(void) refreshInvoked:(id)sender forState:(UIControlState)state
{
    [self refreshFeed];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)refreshFeed
{
    KMXMLParser *parser = [[KMXMLParser alloc]  initWithURL:@"http://www.daytonastate.edu/rss/it.xml" delegate:nil];

    _parseResults = [parser posts];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return self.parseResults.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"DataCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil)
    {

        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle  reuseIdentifier:CellIdentifier];
    }// Configure the cell...
        cell.textLabel.text = (self.parseResults)[indexPath.row][@"title"];

    cell.detailTextLabel.text = (self.parseResults)[indexPath.row][@"summary"];

    [self reloadData];

    return cell;
} 
#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    WebViewController *vc = [[WebViewController alloc] init];

    vc.url = [NSURL URLWithString:(self.parseResults)[indexPath.row][@"link"] ];

    [self.navigationController pushViewController:vc animated:YES];

    //Makes sure function clicks to reader feed.

    // Navigation logic may go here. Create and push another view controller.
}

-(IBAction)pressBtn:(id)sender
{
    UIButton *button= [UIButton buttonWithType:UIButtonTypeRoundedRect];

    if (button.tag==1)
    {
        NSLog(@"Press button 1");
        KMXMLParser *parser = [[KMXMLParser alloc]  initWithURL:@"http://www.daytonastate.edu/rss/cea.xml" delegate:nil];

        _parseResults = [parser posts];

        [self reloadData];
    }
    if (button.tag==2)
    {
        NSLog(@"Press button 2");
        [self EventsBtn:nil];
    }
}

- (IBAction)NewsBtn:(id)sender
{
      KMXMLParser *parser = [[KMXMLParser alloc]  initWithURL:@"http://rss.cnn.com/rss/cnn_topstories.rss" delegate:nil];

        _parseResults = [parser posts];
    NSLog(@"reload happened");
   // self.printMessage = [[PrintHello alloc] init]; // EDIT: THIS LINE WAS MISSING NOW IT WORKS
    //[self.printMessage Print];

    NSLog(@"NewsBtn Pressed");
}

- (IBAction)SportsBtn:(id)sender
    {
       KMXMLParser *parser = [[KMXMLParser alloc]  initWithURL:@"http://www.daytonastate.edu/rss/it.xml" delegate:nil];

        _parseResults = [parser posts];
    }

- (IBAction)EventsBtn:(id)sender
{
    KMXMLParser *parser = [[KMXMLParser alloc]  initWithURL:@"http://www.daytonastate.edu/rss/events.xml" delegate:nil];
    _parseResults = [parser posts];
    NSLog(@"eventsBtn Pressed");
}

- (IBAction)WeatherBtn:(id)sender
    {
        KMXMLParser *parser = [[KMXMLParser alloc]  initWithURL:@"http://w1.weather.gov/xml/current_obs/KDAB.rss" delegate:nil];

        _parseResults = [parser posts];
    }
@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:54:52+00:00Added an answer on June 13, 2026 at 9:54 pm

    In your pressBtn: method, replace this line:

    UIButton *button= [UIButton buttonWithType:UIButtonTypeRoundedRect];
    

    with:

    UIButton *button = (UIButton *)sender;
    

    This assumes that in IB you have already hooked up the pressBtn: method to the appropriate button. The code you had was creating a new button when your pressBtn: action was called. Since this new button has a tag value of 0, nothing happened. The code I propose actually makes use of the button that was tapped by the user.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an RSS reader that lists items in a listview. I also
I have created a simple WordPress plugin that automatically sets my new sites up
I have created a simple search field that will ajax in relevant search results
I have created simple web service for my website that generates some json based
I have created simple AlertDialog with positive and negative buttons. Positive button has registered
I have created simple .NET Web Service (ASMX) that I call from my .NET
I have successfully created a simple RSS feed, but entries keep coming back as
I have created simple async controllers that call into async methods that then call
Could someone help me on this, I have created simple web services using axis2
How to manually create Friendly URLs? (PHP) So I have created simple php file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.