首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >目标C UISearchBar

目标C UISearchBar
EN

Stack Overflow用户
提问于 2011-03-11 02:36:19
回答 1查看 606关注 0票数 1

我这里有个小问题。当我开始输入一些文本时,为什么我的搜索栏会搜索?代码如下:

代码语言:javascript
复制
     - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
         [searchBar setShowsCancelButton:YES animated:YES];
         self.theTableView.allowsSelection = NO;
         self.theTableView.scrollEnabled = NO;
         [theTableView setRowHeight:110];
     }

     - (void)searchDisplayController:(UISearchDisplayController *)controller willShowSearchResultsTableView:(UITableView *)tableView {
         [tableView setRowHeight:[[self theTableView] rowHeight]];
         tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
         [self.tableData removeAllObjects];
     }

     - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
         searchBar.text=@"";

         [searchBar setShowsCancelButton:NO animated:YES];
         [searchBar resignFirstResponder];
         self.theTableView.allowsSelection = YES;
         self.theTableView.scrollEnabled = YES;
     }

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

       // all the function to search

     }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-03-11 02:49:24

实现searchDisplayController:shouldReloadTableForSearchString:并返回NO。这将防止您在搜索时自动重新加载数据。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5264135

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档