#pragma mark - UISearchBarDelegate
//当搜索文本被改变的时候调用
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
  //改变searchController中tableView的位置
_searchController.searchResultsTableView.frame = CGRectMake(kZero, _tableViewY, kScreenW, kScreenH - _tableViewY); [[RealtimeSearchUtil currentUtil] realtimeSearchWithSource:self.dataSource searchText:(NSString *)searchText collationStringSelector:@selector(chatter) resultBlock:^(NSArray *results) {
if (results) {
dispatch_async(dispatch_get_main_queue(), ^{
[self.searchController.resultsSource removeAllObjects];
[self.searchController.resultsSource addObjectsFromArray:results];
[self.searchController.searchResultsTableView reloadData];
});
}
}];
}
05-04 06:51