IOS ---------- UITextField implements filtering of selected pinyin characters,

Source: Internet
Author: User

IOS ---------- UITextField implements filtering of selected pinyin characters,

On the second day of work on April 9, 2018, we carried a big pot. Our project has a search function. In this phase, in order to enhance the optimization, the request to filter spaces may be removed, which may improve the user experience. On the contrary, it is impossible to hack rice into a chicken. I didn't expect that the input method of the Apple system could be automatically associated. When I didn't select Chinese characters, I could think of a lot of smart pinyin. what ??? What else is this operation ???? I almost do not use the input method of the Apple system. my mobile phone settings usually Delete the input method of Apple and use sogou directly. (The input method of the Apple system is too difficult to use.) but for testers, you must test the input methods of each system. Remember! Remember! Remember!

 

Now let's take a look at the content that is not blocked before pinyin.

 

When I enter the blue ocean, the system automatically concatenates some pinyin characters without Selecting Chinese characters.

Are you surprised to compare the printed content? How can we remove pinyin? Add an event to the input box. You can try filtering out pinyin or not in the event.

 

_ SearchTextField = [[UITextField alloc] initWithFrame: CGRectMake (20,100, kScreenWidth-40, 50)];

_ SearchTextField. delegate = self;

_ SearchTextField. backgroundColor = [UIColor orangeColor];

_ SearchTextField. placeholder = @ "Enter funds and quickly locate ";

_ SearchTextField. returnKeyType = UIReturnKeyDone;

_ SearchTextField. clearButtonMode = UITextFieldViewModeWhileEditing;

[_ SearchTextField addTarget: self action: @ selector (searchTextFieldChanges :) forControlEvents: UIControlEventEditingChanged];

[Self. view addSubview: _ searchTextField];

 

-(Void) searchTextFieldChanges :( UITextField *) textField {

If (textField. markedTextRange = nil ){

NSLog (@ "Chinese characters displayed after Chinese characters are selected: % @", textField. text );

 

}

 

}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.