How to pass a variable through a selector?

I have a method

-(void)myMethod:(MyObject*)obj

And I am detaching a new thread

[NSThread detachNewThreadSelector:@selector(myMethod) toTarget:self withObject:nil];

How can I pass a MyObject* through @selector(myMethod)?

Answers


[NSThread detachNewThreadSelector:@selector(myMethod:) toTarget:self withObject:myObjectInstance];

You will definitely want that @selector(myMethod:) instead of @selector(myMethod). They mean different things.


Need Your Help

Time complexity of the following algorithm?

algorithm big-o

I'm learning Big-O notation right now and stumbled across this small algorithm in another thread:

Display and style column total in table footer

jquery css html5 datatables

I am trying to color code a row in table and I am able to do it if I keep sorting disabled .