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: Luke the Hiesterman <email@hidden>
- Date: Sat, 25 Jul 2009 17:11:27 -0700
On Jul 25, 2009, at 4:04 PM, WT wrote:
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.
The reason for the freeze is UITextField implements a couple of the
methods that it defines as delegate methods. The methods then end up
calling themselves repeatedly when the delegate is self. This kind of
thing was never intended to be supported.
Also, as far as the overloading of self.delegate, I think you're
failing to understand some things about objective-c. There's only one
ivar in your class that holds the delegate. There's really no way to
have 2 different objects there. Calling [self delegate] always goes to
the same method no matter where it's called from.
Luke
_______________________________________________
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