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: Tue, 28 Jul 2009 00:16:50 +0200
On Jul 26, 2009, at 4:16 AM, Greg Guerin wrote:
WT wrote:
It seems I'll have to opt for having a regular UITextField and a
custom class whose sole purpose is to provide a delegate that does
the common work. As Kyle suggested, I may need to make that a
superclass and derive additional delegates to perform extra work
after the common task.
As previously noted, you could also give the common-task delegate
its own delegate. Then you get the advantages of delegation, it's
just one level away from the UITextField's direct delegate.
More generally, you could implement the Chain Of Responsibility
pattern in the UITextField's direct delegate (the principal
delegate), so any number of other secondary delegates could
contribute to the overall task, in chain-priority order, and
according to which selectors a secondary delegate implements. Since
any secondary delegate could also be the principal of its own chain,
you have the potential for a tree of delegates.
Yes, after careful consideration, the Chain of Responsibility is the
approach I went with, and it's working great. Thanks for the suggestion.
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