Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tranvutuan

macrumors member
Original poster
Dec 19, 2011
74
0
Hi everyone
If i have my method A like below :

Code:
-(void) myMethodA arg1:myArg1 arg2:myArg2 {
}


How can I use performSelectorOnMainThread do invoke myMethodA....I m stuck because right now we have 2 args in method A but the format of performSelectorOnMainThread is
Code:
[self performSelectorOnMainThread:<#(SEL)#> withObject:<#(id)#> waitUntilDone:<#(BOOL)#>
 
You have two objects that you want to pass to the main thread.

Create an NSDictionary. Add both of these objects to the dictionary. Assign them keys. Pass the dictionary to the main thread.

Receive the NSDictionary. Retrieve both objects. Did you remember to define the keys as global variables?

You could also go to the trouble of creating a custom class that would hold the objects that you want to pass to the main thread.

Grand Central Dispatch removes all of these problems by letting you capture scope variables with blocks. It is really a much smoother approach.
 
You have two objects that you want to pass to the main thread.

Create an NSDictionary. Add both of these objects to the dictionary. Assign them keys. Pass the dictionary to the main thread.

Receive the NSDictionary. Retrieve both objects. Did you remember to define the keys as global variables?

You could also go to the trouble of creating a custom class that would hold the objects that you want to pass to the main thread.

Grand Central Dispatch removes all of these problems by letting you capture scope variables with blocks. It is really a much smoother approach.
Thanks for your help.. I will have it a try
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.