I am using a search bar and search display controller that utilizes an NSPrediate to search a tableview created from core data. The following code works fine for most of my VCs. However, for one where I use a custom cell, whenever I search, I get zero results.
Here is the code in cellforrowatindexpath that adjusts datasource for the search:
Items *item;
if (tableView == self.searchDisplayController.searchResultsTableView) {
item = [searchResults objectAtIndex:indexPath.row];
} else {
item
= [self.fetchedResultsController objectAtIndexPath:indexPath];
}
Since this is the only case where the VC uses a custom cell, I'm wondering if that is why no results return.
This is line that tells cellforrowatindexpath
to use a custom cell:
customCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"Cell"];
cell.item = item;
Finally, this is how the values in the cell are set:
-(void) setItem:(Items *)item{ //open 1
_item = item;
self.nameLabel.text = item.name;
}
Could the custom cell be responsible for no items appearing in search or should I look elsewhere for error?
Note: the count of the items returned upon search is always zero.