Can you programmatically accept spelling corrections in a UITextView?

I have a button that inserts a character into a UITextView. I want this button to behave like a space button; I want the pending auto-correction proposal to be accepted after clicking on it.

Can this be done? If so, how? Thanks!

+7
ios cocoa-touch uitextview
source share
2 answers

There is no API for interacting with autocorrect directly. However, there is a bit of a hack that I encountered not so long ago: if you resign the defendant, the current auto-correct will be displayed. Thus, you can resign from the first responder and then appoint him again:

[myTextView resignFirstResponder]; [myTextView becomeFirstResponder]; 
+4
source share

I just found out that instead (kills my animations) you can use:

  [messageField reloadInputViews]; 

It works like a charm.

+7
source share

All Articles