conceptual question : what do performSelectorOnMainThread do?

Posted by hib on Stack Overflow See other posts from Stack Overflow or by hib
Published on 2010-04-15T12:46:56Z Indexed on 2010/04/15 13:13 UTC
Read the original article Hit count: 311

Filed under:
|
|

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 ?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about concepts