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:04:02 +0200
On Jul 26, 2009, at 12:42 AM, Kyle Sluder wrote:
On Jul 25, 2009, at 3:36 PM, WT <email@hidden> wrote:
No. -delegate returns the "outside" delegate, not self. As I said,
from the outside world, everything is business as usual. If you
call -setDelegate: to set yourself up as the delegate, then you are
what's returned by a call to -delegate.
If that were the case then your delegate insertion technique would
be useless, since whenever UITextField wanted to ask it's delegate
for something it would always get the external object.
Hmm... I think you're right. Still, that has nothing to do with the
freeze since the sample app has no outside delegates.
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.
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