UISearchController无法访问tableview

时间:2016-12-18 06:15:30

标签: ios objective-c uitableview

我的屏幕上有一个searchController

我的问题是当我输入我的tableview来点击一个单元格。搜索控制器位于tableview之上,我无法选择单元格。enter image description here

初始化方法

 self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];


- (void)updateSearchResultsForSearchController:(UISearchController *)aSearchController {
NSLog(@"updateSearchResultsForSearchController");

NSString *searchString = aSearchController.searchBar.text;
NSLog(@"searchString=%@", searchString);

//    [self.moviesTableView setContentOffset:CGPointMake(0, 0)];


// Check if the user cancelled or deleted the search term so we can display the full list instead.
if (![searchString isEqualToString:@""]) {
    [self.filteredMovies removeAllObjects];
    for (FLMovie *movie in self.movies) {
        if ([searchString isEqualToString:@""] || [movie.title localizedCaseInsensitiveContainsString:searchString] == YES) {
            [self.filteredMovies addObject:movie];
        }
    }
    self.displayedItems = self.filteredMovies;
}
else {
    self.displayedItems = self.movies;
   }
    [self.moviesTableView reloadData];
    }
 }

1 个答案:

答案 0 :(得分:0)

我通过在演示期间删除调光背景来修复它。

self.searchController.dimsBackgroundDuringPresentation = NO;