IOS UITableView reloadData updates the table only the second time I call the reload function

Here is my reboot function

- (void) reloadTable:(id)sender
{   
    NSLog(@"Reload Table");
    NSLog(@"%@",[appDelegate queryList]);
    [self.driverTable reloadData];
    [self.driverTable setNeedsLayout];
    [self.driverTable setNeedsDisplay];
}

Here I call it after getting data from webservice

if( [elementName isEqualToString:@"Response"]) {
    Response = NO;
    LookupView *lookupView = [[LookupView alloc] initWithNibName:@"LookupView" bundle:nil];
    [lookupView reloadTable:self];
}

The problem that I have now is after I performed the search by clicking the search button and receiving the data. The table is not updated with new data. If I call the same function again by pressing the search button again, the table will reload. Now I know that there is data, because I print the array before I invoke a table reload.

Any ideas why?

+5
source share
2 answers

. Apple Apple reloadData " , ". , , - reloadData, . :

[self performSelector:@selector(delayedReloadData) withObject:nil afterDelay:0.5];

delayReloadDataโ€‹โ€‹p >

 -(void)delayedReloadData{
    [self.tableView reloadData];
}

, , , , , .

+6

, XML, , elementName if loop. load a NIB file . ? reloadTable: , .

[self reloadTable:self];

tableView app delegate. , ViewController?

0

All Articles