[NSThread detachNewThreadSelector:]和-performSelectorInBackground之间的差异 [英] Difference between [NSThread detachNewThreadSelector:] and -performSelectorInBackground
问题描述
我在许多应用程式中一直使用 -performSelectorInBackground
,不知道 -detachNewThreadSelector
。现在我想知道两者之间的区别。它们是可以互换的,还是有差异和地方,一个是优于另一个?谢谢!
I've been using -performSelectorInBackground
in many of my apps, sort of oblivious to -detachNewThreadSelector
. Now I am wondering what the differences are between the two. Are they pretty much interchangeable, or are there differences and places where one is superior to the other? Thanks!
推荐答案
它们完全相同。请参阅文档。
They're identical. See documentation.
performSelectorInBackground:withObject:
调用此方法的效果是一样的就像你调用当前对象,选择器和参数对象作为参数的NSThread的detachNewThreadSelector:toTarget:withObject:方法。
performSelectorInBackground:withObject: The effect of calling this method is the same as if you called the detachNewThreadSelector:toTarget:withObject: method of NSThread with the current object, selector, and parameter object as parameters.
这篇关于[NSThread detachNewThreadSelector:]和-performSelectorInBackground之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!