I recently tried to subclass UITextField and set the delegate to myself (found this trying ti solve my problem: http://www.cocoabuilder.com/archive/cocoa/241465-iphone-why-can-a-uitextfield-be-its-own-delegate.html)
@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
Calling a method defined on the interface results in an infinite recursion. I don’t see anything in the Apple docs that defines how respondsToSelector is supposed to behave in the presence of a delegate.
The docs for
respondsToSelectorstates the following:It seems that this could be the cause for your recursion problem. I don’t know if the delegate stuff is even related. Just a guess though.