1

Possible Duplicate:
How can I disable/enable UISearchBar keyboard's Search button?

Can we disable the 'Search' button in the keyboard for a search bar? I want to enable it after user enters 3 characters in the search bar.

Community
  • 1
  • 1
Abhinav
  • 37,684
  • 43
  • 191
  • 309
  • Please check the below link: http://stackoverflow.com/questions/9721668/how-can-i-disable-enable-uisearchbar-keyboards-search-button – Midhun MP Jun 13 '12 at 20:07

1 Answers1

1

Apparently, you can't do that. You need to implement UISearchBar's delegate

- searchBarSearchButtonClicked:    

You can just add a condition in your delegate like:

 - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar1 {
     if ([searchBar.text length] < 3){
          return;
     }
     else {
          // Do searching here or other stuffs
     }
}
Kimpoy
  • 1,974
  • 3
  • 21
  • 38
  • 1
    This looks like a copy and paste of this: http://stackoverflow.com/a/9722139/419 – Kev Jun 15 '12 at 00:15