-1

I have a table of contents and have a search bar in the top, however, when I search for a particular name in the table content it doesn't show up in the table view, however, i have "NSLog" which is printing my search result. the search result is correct but it doesn't show in the table view; here is the function am using

Crazy
  • 386
  • 2
  • 4
  • 13
  • I found that you are filtering the result using a predicate but didn't find any code where you are rebinding your filtered result with your UISearchDisplayController's table view. – Ayan Sengupta Feb 10 '14 at 19:56

1 Answers1

0

check your these methods implementation

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView==self.mySearchDisplayController.searchResultsTableView) {

    return [_filteArray count];
}
else{

    return [_myArray count];
}
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identifier=@"Cell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];
if (cell==nil) {

    cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier];
}

if (tableView == self.mySearchDisplayController.searchResultsTableView) {

    placeObject=(GCSearchObject*)[_filterArray objectAtIndex:indexPath.row];
    cell.textLabel.text=placeObject.serviceName;

} else {
    placeObject=(GCSearchObject*)[_myArray objectAtIndex:indexPath.row];
    cell.textLabel.text=placeObject.serviceName;
}
return cell;
}
Pawan Rai
  • 3,434
  • 4
  • 32
  • 42