9
次のタイプのメソッドを呼び出す方法の違いは何ですか?[self MethodName]と[self performSelector:@selector(Method Name)]の違い
と
2.
[self performSelector:@selector(methodName)]; // no afterDelay is used
performSelectorは別のスレッドを使用しますか? ?
次のタイプのメソッドを呼び出す方法の違いは何ですか?[self MethodName]と[self performSelector:@selector(Method Name)]の違い
と
2.
[self performSelector:@selector(methodName)]; // no afterDelay is used
performSelectorは別のスレッドを使用しますか? ?
ほとんどの場合、同等です。
documentationによれば、performSelector:
の目的は、動的に定義され、コンパイル時には実際には存在しないメソッドを呼び出すことができるようにすることです。それで全部です。コンパイル時にがであるメソッドを呼び出す場合、この2つの間に違いはありません。
可能な重複スレッド:http://stackoverflow.com/questions/2674827/using-self-method- or-selectormethod –