How to detect user is mid-way inputting with an Input Method?

后端 未结 1 545
抹茶落季
抹茶落季 2021-02-04 11:11

If user is inputting in a UITextView using an Input Method such as Chinese Pinyin, there is a state where the Pinyin is already displayed in tne text view but user is still yet

1条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 12:15

    Finally got it. Input methods like Pinyin are called Multistage Text Input. The first stage is called Marked, the second stage is called Committed. To determine whether it is in Marked stage, one should query UITextInput Protocol's markedTextRange property:

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

    0 讨论(0)
提交回复
热议问题