Re: [iPhone] Why can't a UITextField be its own delegate?
Re: [iPhone] Why can't a UITextField be its own delegate?
- Subject: Re: [iPhone] Why can't a UITextField be its own delegate?
- From: WT <email@hidden>
- Date: Sun, 26 Jul 2009 01:18:18 +0200
On Jul 26, 2009, at 1:04 AM, WT wrote:
Now, I agree that UITextField will run into an infinite loop (in the
sample app) when calling -respondsToSelector on its delegate because
it is its own delegate. However, why is it then that -
textFieldShouldBeginEditing returns successfully and -
textFieldDidBeginEditing executes but doesn't return? Both of them
successfully print their method names:
- (BOOL) textFieldShouldBeginEditing: (UITextField*) text_field
{
NSLog(@"-textFieldShouldBeginEditing:");
return YES;
}
- (void) textFieldDidBeginEditing: (UITextField*) text_field
{
NSLog(@"-textFieldDidBeginEditing:");
}
It would seem that -respondsToSelector: is not being called at all.
Actually, it is and I do get an infinite loop, thanks to
- (BOOL) respondsToSelector: (SEL) selector
{
NSLog(@"-respondsToSelector:");
return [super respondsToSelector: selector];
}
How do I get a string for the name of the method represented by the
selector?
Wagner
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden