• 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: Luke the Hiesterman <email@hidden>
  • Date: Sat, 25 Jul 2009 14:46:47 -0700

That approach makes much more sense.

Luke

On Jul 25, 2009, at 2:44 PM, Kyle Sluder wrote:

On Sat, Jul 25, 2009 at 1:14 PM, WT<email@hidden> wrote:
This particular text field needs to limit its number of characters to a
given interval. Why should any other object have to deal with that problem
when the field itself can take care of it? Still, it might be the case,
though it also might not be the case, that another object wants to
participate in the editing session. The flow of events here is as follows:
the field takes care of its own business first (limiting the number of
characters) and then allows the delegate, if any, to have its shot at the
editing process.

In the Cocoa world, it makes more sense to hook up a delegate to do this work, especially if this is a one-off control. It comes down to thinking of it as "a text field which limits number of characters" rather than "a number-of-characters-limited text field". If you need this behavior in multiple places in your application, you can factor out the delegate behavior into a superclass and have your delegates derive from it, calling this method when necessary.

--Kyle Sluder

_______________________________________________

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


  • Follow-Ups:
    • Re: [iPhone] Why can't a UITextField be its own delegate?
      • From: WT <email@hidden>
References: 
 >[iPhone] Why can't a UITextField be its own delegate? (From: WT <email@hidden>)
 >Re: [iPhone] Why can't a UITextField be its own delegate? (From: Brian Slick <email@hidden>)
 >Re: [iPhone] Why can't a UITextField be its own delegate? (From: WT <email@hidden>)
 >Re: [iPhone] Why can't a UITextField be its own delegate? (From: Luke the Hiesterman <email@hidden>)
 >Re: [iPhone] Why can't a UITextField be its own delegate? (From: WT <email@hidden>)
 >Re: [iPhone] Why can't a UITextField be its own delegate? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: [iPhone] Why can't a UITextField be its own delegate?
  • Next by Date: Multiple delegates Window
  • Previous by thread: Re: [iPhone] Why can't a UITextField be its own delegate?
  • Next by thread: Re: [iPhone] Why can't a UITextField be its own delegate?
  • Index(es):
    • Date
    • Thread