• 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: what does the return value for textFieldShouldReturn actually do???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what does the return value for textFieldShouldReturn actually do???


  • Subject: Re: what does the return value for textFieldShouldReturn actually do???
  • From: Matt Neuburg <email@hidden>
  • Date: Sun, 17 Feb 2013 09:32:37 -0800

On Tue, 01 Jan 2013 20:15:00 +0800, Roland King <email@hidden> said:
>I have a UITextField with a delegate. I implement textFieldShouldReturn: and that returns a BOOL value. The docs say this about the return value
>
>YES if the text field should implement its default behavior for the return button; otherwise, NO.
>
>I've never seen any difference in behaviour between returning YES or NO. What is this default behaviour I'm asking it to do, or not do?

It has to do with the Did End on Exit control event; this event, if hooked up, causes the keyboard to be dismissed when the user taps the Return button, *unless* textFieldShouldReturn: stops it by returning NO. That is why, as my book explains, the best way to get automatic dismissal of the keyboard is to hook up Did End on Exit (possibly nil-targeted and uncaught) and either return YES from textFieldShouldReturn: or don't implement it at all. You can get automatic keyboard dismissal with *no code* this way.

http://www.apeth.com/iOSBook/ch23.html#_uitextfield

m.

--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
_______________________________________________

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

  • Prev by Date: Re: Binding a NSArrayController to a NSPopupButtonn & NSTextField
  • Next by Date: Re: Core Foundation Objects and Properties when using ARC
  • Previous by thread: Re: cocoa bindings performance
  • Next by thread: Re: Core Foundation Objects and Properties when using ARC
  • Index(es):
    • Date
    • Thread