는 최근의 UITextField를 서브 클래 싱을 시도하고 (TI 내 문제를 해결하려고이 발견 : http://www.cocoabuilder.com/archive/cocoa/241465-iphone-why-can-a-uitextfield-be-its-own-delegate.html) 자신에게 위임 설정 무한 재귀의 인터페이스 결과에 정의 된 메소드를 호출대리인이있을 때 respondsToSelector는 어떻게 작동합니까?
@interface MyObject :UITextField <UITextFieldDelegate>
@end
@implementation MyObject
-(id) initWithFrame:(CGRect) frame
{
if((self=[super initWithFrame:frame]))
{
self.delegate=self;
}
return self;
}
-(BOOL) respondsToSelector:(SEL)selector
{
NSLog(@"responds to selector");
return [super respondsToSelector:selector];
}
// Implement all the missing methods
@end
합니다. respondsToSelector가 델리게이트가있는 상태에서 어떻게 행동해야하는지 정의하는 Apple 문서에는 아무것도 표시되지 않습니다. 다음
BTW, 나는 그냥 무한 재귀가 진행되고 있는지 확인하기 위해 respondsToSelector를 재정의하고 있습니다. – Megasaur