Method call through performSelectorOnMainThread Vs Normal method call

can anyone tell me what is different when i call a method using performSelectorOnMainThreadand calling the same method without performSelector.

For Exa.

-(void)sampleCALL{
     ..........
}

NOW Call this method using these two senario:

[[self performSelectorOnMainThread:@selector(sampleCALL) withObject:nil waitUntilDone:NO];];

or

[self sampleCALL];

How are these two methods performed? Please help me find this concept correctly.

+3
source share
1 answer

in the first case, [self sampleCALL];your method will be called in the thread where the control was currently. it will support all stack manipulations, which it does to call a method from another method.

while

[[self performSelectorOnMainThread:@selector(sampleCALL) withObject:nil waitUntilDone:NO];];

. .

+2

All Articles