MissCoder87
MissCoder87

Reputation: 2669

iPhone reloading data in a table

I populate the data from my table using a loadResults routine which runs on viewDidLoad (through mHud) which works fine. However now I want to slightly alter the results from distance to accessibility (just changing the url it parses the data from)

I tried on the switch re-running my loadResults but it doesn't seem to do anything. If i change the url it parses then swap to the same page it loads the correct new results (but screws up my navigational controller and I'm pretty sure wastes a tonne of memory doing that).

So basically I have:

-(void)loadResults {

//routine to parse XML files 


  [self.view reloadData];
}


- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = @"Results";

    HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    HUD.labelText = @"Loading";
    HUD.detailsLabelText = @"updating data"; 

    [HUD showWhileExecuting:@selector(loadResults) onTarget:self withObject:nil animated:YES];

}

I've just put a button on my navigational controller which swaps between them.

So i guess in essence, how do i re load my table with the new data?

Tom

Upvotes: 0

Views: 128

Answers (3)

Ravi Kumar Karunanithi
Ravi Kumar Karunanithi

Reputation: 2218

u can use this code.

[self.tableView reloadData];

Upvotes: 0

Rafał Sroka
Rafał Sroka

Reputation: 40030

If your controller is a subclass of UITableViewController you should modify the loadResults method:

-(void)loadResults {

    //routine to parse XML files 

      [self.tableView reloadData]; 
}

So, use self.tableView instead of self.view.

Upvotes: 1

Deepesh
Deepesh

Reputation: 643

I think this code is help of your

#pragma mark -
#pragma mark MBProgressHUDDelegate methods

- (void)hudWasHidden  { 
    // Remove HUD from screen when the HUD was hidded
    [HUD removeFromSuperview];
    [HUD release];
    [tbleName reloadData]; }

Upvotes: 1

Related Questions