如何使用performSelector:onThread:withObject:waitUntilDone:?在这个线程中,我必须使用其他线程,而不是主线程。如何创建其他线程?给我一些代码样本。
发布于 2010-05-13 12:23:05
除非您有一个要管理的线程池,否则使用-performSelectorInBackground:…更容易
[object performSelectorInBackground:@selector(method:) withObject:foo];如果要创建线程,请使用
NSThread* thread = [[NSThread alloc] init];
[object performSelector:@selector(method:)
onThread:thread
withObject:foo
waitUntilDone:YES];
[thread release];https://stackoverflow.com/questions/2826617
复制相似问题