开发者

Using the iPhones Multi-Touch Keyboard Search Button

开发者 https://www.devze.com 2022-12-28 07:06 出处:网络
I have a regular text field on a view and I\'d like to make use of the search button on the iPhones keyboard. For the life of me, I can\'t figure out how to do this. There doesn\'t seem to be any even

I have a regular text field on a view and I'd like to make use of the search button on the iPhones keyboard. For the life of me, I can't figure out how to do this. There doesn't seem to be any event exposed that I can wire up that specifically relates to the search button on the keyb开发者_如何学Gooard. I've googled around, but I also haven't found anything related to this subject.


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

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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消