All*_*len 0 iphone xcode objective-c
如何使用performSelector:onThread:withObject:waitUntilDone:?这里在onthread我必须使用其他线程而不是主线程.如何创建其他线程?给我一些示例代码.
除非您有一个要管理的线程池,否则它更容易使用-performSelectorInBackground:…:
[object performSelectorInBackground:@selector(method:) withObject:foo];
Run Code Online (Sandbox Code Playgroud)
如果您要创建一个线程,请使用
NSThread* thread = [[NSThread alloc] init];
[object performSelector:@selector(method:)
onThread:thread
withObject:foo
waitUntilDone:YES];
[thread release];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4887 次 |
| 最近记录: |