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 12:47:30 -0700
Wow, this all sounds very convoluted. If you must have two levels of
delegation (which sounds like flawed design, to me) then I would
suggest doing it in a more straightforward manner. That is, make a
delegate for UITextField, and then have another delegate protocol for
that object so it can have its own delegate. Even better, just wrap
everything you need into the object you set as delegate to UITextField
and don't try to shove weird things into a subclass.
Luke
On Jul 25, 2009, at 12:39 PM, WT wrote:
The reason is simple, though probably not obvious.
I still might need the text field to have an "outside" delegate,
which I maintain by having an additional outlet reserved for that
delegate. Then, I override -delegate to return that outlet and -
setDelegate: to set it.
That way, the field can be its own true delegate and do its job,
while also allowing an outside object to serve as a delegate and
participate in the editing session. As far as the outside world is
concerned, it's business as usual.
But once I have an overridden -setDelegate:, I can't use
self.delegate = self to set the field as its own true delegate,
because that will execute the overridden method.
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