开发者

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)?


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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜