• 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: Setting a delegate on a UITextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting a delegate on a UITextField


  • Subject: Re: Setting a delegate on a UITextField
  • From: Matt Neuburg <email@hidden>
  • Date: Mon, 07 Mar 2011 09:30:05 -0800

On Mon, 07 Mar 2011 09:02:36 -0800 (PST), Jon Sigman <email@hidden> said:
>On Sat, 05 Mar 2011 11:22:46 -0800 Matt Neuburg wrote:
>> One possible approach on iOS is to implement textFieldShouldEndEditing, and
>>return NO and put up an alert if there's a problem. Another is just to make the
>>change yourself in textFieldDidEndEditing. See the section entitled "Validating
>>Entered Text" (along with the preceding section) in the "Managing Text Fields
>>and Text Views" chapter of the Text, Web, and Editing Programming Guide for iOS.
>>
>That looks like a good fit. But is there some trick in
>getting textFieldShouldEndEditing invoked? I have also
>a textFieldDidBeginEditing and a textFieldDidEndEditing method; they get invoked
>when
>the user touches the "Return" key on the keypad, but textFieldShouldEndEditing
>does not.

This has nothing to do with the "Return" key on the keypad - it has to do with the text field resigning its first responder status. The "Return" key invokes textFieldShouldReturn: and does *not* automatically resign first responder (unless you've implemented Did End on Exit). As usual, I suggest you make a teeny little test project, completely clean, consisting of just a text field and its delegate, so as to prove to yourself that textFieldShouldEndEditing: is in fact called. m.

--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________

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: Setting a delegate on a UITextField
      • From: Jon Sigman <email@hidden>
  • Prev by Date: Re: binding relationship to checkbox
  • Next by Date: Proper way to construct an Attribute NSXMLNode so that its prefix is included in its XMLString
  • Previous by thread: Re: Setting a delegate on a UITextField
  • Next by thread: Re: Setting a delegate on a UITextField
  • Index(es):
    • Date
    • Thread