我有一个带有 searchView 和 tableView 的视图控制器,我希望 tableView 根据 searchView 的文本显示来自网络搜索的结果(随着您向搜索添加更多字母而改变)。
正如我现在所拥有的那样,每次添加一个字母时,它都会正确搜索,但应用程序会在搜索时停止,因此在返回最后一个结果之前您无法添加新字母。
有没有更聪明的方法来做到这一点,以便在添加新字母时最后一次搜索基本上中止?
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
if(searchText.length>3)
{
[self getWebDataWithQuery:searchBar.text]
[tblResults reloadData];
}
}