禁用搜索栏键盘中的“搜索”按钮

可能重复:
如何禁用/启用UISearchBar键盘的“搜索”按钮?

我们可以在键盘中禁用搜索栏中的“搜索”按钮吗? 我想在用户在搜索栏中输入3个字符后启用它。

显然,你做不到。 您需要实现UISearchBar的委托

- searchBarSearchButtonClicked: 

您可以在代理中添加条件,例如:

  - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar1 { if ([searchBar.text length] < 3){ return; } else { // Do searching here or other stuffs } }