전무 나는 코드차이는
의 다음 줄[self performSelector:@selector(myMethod) withObject:self afterDelay:1.0];
[self performSelector:@selector(myMethod) withObject:nil afterDelay:1.0];
- 에 대해 궁금 한 뭐죠 위의 코드 두 줄 사이의 차이.
- 언제 개체를
nil
으로 설정해야하며 언제 개체를self
으로 설정해야합니까?
대부분의 경우 나는 nil
으로 설정할 개체를 발견했습니다.
문서 읽기 https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsobject_Class/Reference/Reference.html –
문서를 읽었습니다. 같은 맥락에서 두 줄의 코드를 모두 시도해 보았습니다. 그래서 차이점을 알고 싶었습니다. 나는 인터넷 검색을 할 수 없었습니다. –
- (void) performSelector : (SEL) aSelector withObject : (id) anArgument afterDelay : (NSTimeInterval) delay anArgument : 메서드가 호출 될 때 메서드에 전달할 인수입니다. 메소드가 인수를 취하지 않으면 을 전달하십시오. –