Re: what does the return value for textFieldShouldReturn actually do???
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