搜索显示在点击搜索栏之前不显示结果

发布于 2024-08-29 02:23:23 字数 127 浏览 7 评论 0原文

我想我可能遗漏了一些明显的东西:

是否有一种简单的方法来修改 UISearchBar 或 UISearchDisplayController ,以便它不会在输入每个字母后重新加载视图,而是仅在单击“搜索”按钮后重新加载视图?

I think I may be missing something obvious:

Is there a simple way to modify the UISearchBar or UISearchDisplayController so that it doesn't reload the view after each letter typed but only after the Search button is hit?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泛泛之交 2024-09-05 02:23:23

我想通了。我发现的大多数示例都在此处搜索文本:

- (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText

但我只是没有实现该方法,而是编写了我自己的搜索函数,我在此处调用了该函数:

// called when keyboard search button pressed

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{

    [self fetchTheSearchString:searchBar.text];
    [searchBar resignFirstResponder];
    [self.tableView reloadData];

}

I figured it out. Most of the examples I found search the text here:

- (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText

but I just didn't implement that method and instead just wrote my own search function which I called here:

// called when keyboard search button pressed

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{

    [self fetchTheSearchString:searchBar.text];
    [searchBar resignFirstResponder];
    [self.tableView reloadData];

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文