Here is my reload function
- (void) reloadTable:(id)sender
{
NSLog(@"Reload Table");
NSLog(@"%@",[appDelegate queryList]);
[self.driverTable reloadData];
[self.driverTable setNeedsLayout];
[self.driverTable setNeedsDisplay];
}
Here is where I call it after receiving data from the webservice
if( [elementName isEqualToString:@"Response"]) {
Response = NO;
LookupView *lookupView = [[LookupView alloc] initWithNibName:@"LookupView" bundle:nil];
[lookupView reloadTable:self];
}
Problem I have right now is after I do a search by pressing a find button and receive the data. The table does not refresh with the new data. If I call the same function again by pressing the find button again the table reloads. Now I know the data is there because I print the array out before I call the table reload.
Any ideas why?
I have run into the same issue. Per Apple's documentation, reloadData "should not be called in the methods that insert or delete rows." A workaround I have used is to delay the call to reloadData so that it is not immediately after updating table. Try this:
at the appropriate place with the following implementation of delayReloadData
A negative side affect I have see from this approach is that if the table row is visible there is a short delay before it shows its content.
I found out you are doing XML parsing by seeing that
elementName
in yourif loop
. Why you need toload a NIB file
in your parsing code. What is the use of it? You can just call yourreloadTable:
method just like this.You are populating your tableView using some array in your
app delegate
file. So did you initialized your delegate in your ViewController?