UITableViewCell reloadData method not working
The reloadData does not work.
Code :
- (void)viewDidLoad
{
allOnMapButton.hidden = YES;
volLocApp = (MyAppDelegate *) [[UIApplication sharedApplication] delegate];
[self performSelectorInBackground:@selector(startParsing) withObject:nil];
total = [volLocApp.volListArray count];
[super viewDidLoad];
}
- (void) startParsing
{
[self performSelectorOnMainThread:@selector(startIndicator) withObject:nil waitUntilDone:NO];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSURL *url = [[NSURL alloc] initWithString:@"Link"];
NSData *data = [NSData dataWithContentsOfURL:url];
// 2 -- parsing
parser = [[MyParser alloc] init];
[parser parseXML:data];
[data release];
[parser sortTheArray];
[parser print];
[self performSelectorOnMainThread:@selector(updateTable) withObject:nil waitUntilDone:NO];
[pool release];
}
- (void) startIndicator
{
av.hidesWhenStopped = YES;
[av startAnimating];
}
- (void) updateTabl开发者_JAVA百科e
{
allOnMapButton.hidden = NO;
[av stopAnimating];
[myTable reloadData];
}
What is wrong in above code? The reload method does not work. If I go back and return to this view then only data is displayed.
Make sure your myTable has been defined through an IBOutlet, and correctly linked to your table view. If nothing happens with no errors, this is usually the case.
can u post your code in some git repo? there may be several causes fir that try setNeedsDisplay for your table's super view and u can also try perform selector on main thread rather than background to see if any differences. Usually the view updation is on main thread only and that may be an issue
精彩评论