conceptual question : what do performSelectorOnMainThread do?
- by hib
Hello all,
I just come across this strange situation .
I was using the technique of lazy image loading from apple examples .
when I was used the class in my application it gave me topic to learn but don't what was actually happening there .
So here goes the scenario :
I think everybody has seen the apple lazytableimagesloading .
I was reloading my table on finishing the parsing of data :
- (void)didFinishParsing:(NSMutableArray *)appList
{
self.upcomingArray = [NSMutableArray arrayWithArray:loadedApps];
// we are finished with the queue and our ParseOperation
[self.upcomingTableView reloadData];
self.queue = nil; // we are finished with the queue and our ParseOperation
}
but as a result the the connection was not starting and images were not loading . when I completely copy the lazyimageloading and I replaced the above code with the following code it works fine
- (void)didFinishParsing:(NSMutableArray *)appList
{
[self performSelectorOnMainThread:@selector(handleLoadedApps:) withObject:appList waitUntilDone:NO];
self.queue = nil; // we are finished with the queue and our ParseOperation
}
So I want to know what is the concept behind this .
Please let me know if you can not understand the question or details are not enough because I desperately want to know why it is like this ?