Using the Multi-Touch iPhones Keyboard Search Button

I have a plain text box in the view and I would like to use the search button on the iPhones keyboard. For my life, I cannot figure out how to do this. It seems that there was no event that I can connect, which specifically relates to the search button on the keyboard. I googled around, but I also did not find anything related to this subject.

+3
source share
1 answer

Make the keyboard display the blue Search button by setting the type of return key.

myTextField.returnKeyType = UIReturnKeySearch;

Set the delegate of your text field to your controller and implement the textFieldShouldReturn: method.

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    /* Do some searching here */
    return YES;
}
+6
source

Source: https://habr.com/ru/post/1742286/


All Articles