Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UISearchbar';滚动searchResultsTableView时显示的范围栏_Iphone_Ios_Tableview_Uisearchbar - Fatal编程技术网

Iphone UISearchbar';滚动searchResultsTableView时显示的范围栏

Iphone UISearchbar';滚动searchResultsTableView时显示的范围栏,iphone,ios,tableview,uisearchbar,Iphone,Ios,Tableview,Uisearchbar,我有一个带有searchDisplayController的UISearchbar,可以通过IB拖动到我的tableview。我的搜索范围栏在不处于搜索模式时隐藏。当我开始搜索时,范围栏将显示如下图所示 然后我键入我的文本,并在滚动结果范围栏时显示搜索结果,如下所示 那么,当滚动时,我应该如何显示范围栏呢 这是我的代码: - (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller {

我有一个带有searchDisplayController的UISearchbar,可以通过IB拖动到我的tableview。我的搜索范围栏在不处于搜索模式时隐藏。当我开始搜索时,范围栏将显示如下图所示

然后我键入我的文本,并在滚动结果范围栏时显示搜索结果,如下所示

那么,当滚动时,我应该如何显示范围栏呢

这是我的代码:

- (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller {
    controller.searchResultsTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    controller.searchResultsTableView.bounces = NO;
}

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {
    self.searchDisplayController.searchBar.showsScopeBar =YES;
    [self.searchDisplayController.searchBar sizeToFit];
    [self.searchDisplayController.searchBar setShowsCancelButton:YES animated:YES];
    return YES;
}
我发现了我的问题 在

我设定了

self.searchDisplayController.searchBar.showsScopeBar

因此,当我滚动表格查看此方法调用并隐藏范围栏时,请发布-(void)searchBarTextDidBeginEditing:(UISearchBar*)搜索栏方法的代码。@ParasJoshi:我编辑我的问题并添加代码。我没有使用-(void)SearchBartextDiBeginediting:(UISearchBar*)搜索您为showscopebar设置否的任何位置??意味着您可以将其隐藏在任何位置,只需选中并将其添加为视图的子视图,而不是UITableView
self.searchDisplayController.searchBar.showsScopeBar