开发者

How to use performSelector:

开发者 https://www.devze.com 2022-12-29 23:34 出处:网络
How to use performSe开发者_如何学编程lector:onThread:withObject:waitUntilDone:? here in onthread i have to use other thread not main thread. How to create other thread? give me some sample code.Unless

How to use performSe开发者_如何学编程lector:onThread:withObject:waitUntilDone:? here in onthread i have to use other thread not main thread. How to create other thread? give me some sample code.


Unless you have a thread pool to manage, it's easier to use -performSelectorInBackground:…:

[object performSelectorInBackground:@selector(method:) withObject:foo];

If you're going to create a thread, use

NSThread* thread = [[NSThread alloc] init];
[object performSelector:@selector(method:)
               onThread:thread
             withObject:foo
          waitUntilDone:YES];
[thread release];
0

精彩评论

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

关注公众号