Sometimes, in the case of textviewdidchange processing related logic judgments, in Chinese input cases, such as input "medium", the corresponding pinyin "Zhong", in the Textviewdidchange method will be counted pinyin in the This results in the input of Chinese as well as the unwanted English. Also, for example, enter the @ character under the nine Gongge Textviewdidchange method will be called two times, which causes the @ Jump transfer two times to solve the following methods:
NSString *lang = textView.textInputMode.primaryLanguage;//get keyboard Input mode if([lang isequaltostring:@"Zh-hans"]){//Nine lattice//when pinyin is entered, Selectedrange will have value input complete selectedrange will be equal to nil//so after the input, the related logical operationUitextrange *selectedrange =[TextView Markedtextrange]; if(!selectedrange) {//Pinyin all input complete//write related input listening logic }Else{//Pinyin monitoring on bar//no processing. } }Else{//In the English case//write related input listening logic}
If you encounter other problems, you will continue to add
IOS TextView in Call Textviewdidchange method, nine Gongge related Chinese input problem