• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [iPhone] Why can't a UITextField be its own delegate?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: [iPhone] Why can't a UITextField be its own delegate? (From: Greg Guerin <email@hidden>)

  • Prev by Date: Re: How to set the string and integer value of an NSButtonCell using NSOutilneView
  • Next by Date: Re: nil there not here
  • Previous by thread: Re: [iPhone] Why can't a UITextField be its own delegate?
  • Next by thread: How to tell an object to notify its KVOs that one of its properties needs to be re-cached...
  • Index(es):
    • Date
    • Thread