9

I have a button that inserts a character into a UITextView. I want this button to behave as the spacebar button does; I want the pending autocorrect suggestion to be accepted upon pressing it.

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

4

3 に答える 3

8

これを行う(アニメーションを殺す)代わりに、次を使用できることがわかりました。

  [messageField reloadInputViews];

魅力のように機能します。

于 2011-10-24T11:14:13.877 に答える
6

オートコレクトと直接対話するAPIはありません。ただし、少し前に遭遇したハックがあります。レスポンダーを辞任すると、現在表示されているオートコレクトが受け入れられます。したがって、最初のレスポンダーを辞任してから再度割り当てることで解決できる場合があります。

[myTextView resignFirstResponder];
[myTextView becomeFirstResponder];
于 2011-05-19T23:15:18.873 に答える