Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In addition to the other answers here (which essentially confirm there's no major difference, no auto-resigning of the first responder by returning <code>YES</code>, etc.), I've discovered a <strong>strange occurrence completely dependent on the return value</strong>, specifically for a <code>UITextField</code> with autocorrection.</p> <h2>Assume the following scenario:</h2> <ol> <li><p>You have a <code>UITextField</code> with autocorrection enabled</p></li> <li><p>You've implemented the delegate method something like this (where the text field gets resigned):</p> <blockquote> <pre><code>- (BOOL)textFieldShouldReturn:(UITextField *)textField { if (textField == self.myAutocorrectingTextField) { [self.myAutocorrectingTextField resignFirstResponder]; } return YES; } </code></pre> </blockquote></li> <li><p>You run the app, type "<em>Cable</em>" into the text field, then press the return key, resigning it as first responder.</p></li> </ol> <h2>The outcome when returning <code>YES</code>:</h2> <ul> <li>The text field's text will have been changed from "<em>Cable</em>" to "<em>Cables</em>"!</li> </ul> <p>I have tested a handful of other words that respond similarly:</p> <ul> <li>"Stuff" changed to "Stuffs"</li> <li>"Ten" to "Tens"</li> <li>And, one time "Car" changed to "Carl", another time "Car" changed to "Carp"</li> </ul> <h2>The outcome when returning <code>NO</code>:</h2> <p><strong>Normal</strong>. The text field's text will not have been changed. </p> <h1>In Summary...</h1> <p>When returning <code>YES</code>, the text field may autocorrect already-correct words. It does not, however, present one of those "autocorrect text bubbles", because these are legitimate words.</p> <p>When returning <code>NO</code>, the text field will not autocorrect already-correct words.</p> <p><strong>Note:</strong> In both cases, incorrectly-spelled words will always be corrected. For example:</p> <ul> <li>If you were to type "Wev", an "autocorrection text bubble" should appear with the text "Web". If you hit the Return key, regardless of the delegate's return value, the text will be replaced with the correction.</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload