How to detect a user - is it input in the middle using the input method?

If a user types in a UITextView using an input method such as Chinese pinyin, there is a state in which the pinyin is already displayed in text form, but the user has not yet determined the final Chinese characters. The screenshot will be more clear:

enter image description here

I want to do some text completion for the user, but I have to do this only for real input (choose Chinese characters), but not for Pinyin intermediate login. Therefore, I need to detect this waiting state.

+7
source share
1 answer

I finally understood. Input methods such as pinyin are called Multistage Text Input . The first stage is called Marked , the second stage is Committed . To determine if it is in the Marked stage, the UITextInput Protocol markedTextRange property should be requested:

 if (textView.markedTextRange != nil) { // Marked. } 
+24
source

All Articles