views:

63

answers:

2

I have a UISearchDisplayController that is properly hooked up in IB.

delegate = Files Owner
searchBar = Search Bar
searchContentsController = Files Owner
searchResultsDataSource = Files Owner
searchResultsDelegate = Files Owner

When my UITableView calls numberofRowsInSection the correct number is returned.

However, my cells in cellForRowAtIndexPath don't even reach:

- (UITableViewCell *)tableView:(UITableView *)tblView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

 if (tblView == searchController.searchResultsTableView){
  NSLog(@"search will go here");
  UITableViewCell* cell = [self provideSearchQueryCells:tblView identifer:@"searchQueryCell"];
  STSymbol *aSymbol = [self.searchQueryResults objectAtIndex:indexPath.row];

  cell.textLabel.text = aSymbol.symbol;
  cell.detailTextLabel.text = aSymbol.symbol_title;

  return cell;
 }
 else { ... }

It always goes to the else condition. I am not exactly sure why.

A: 

This is a guess from this close in on the code, but are we looking at the search display controller itself? Maybe your self.searchDisplayController.searchResultsTableView should just be self.searchResultsTableView.

I can't be sure without knowing your delegates.

UltimateBrent
I believe so, because this code is in a UITableViewController subclass. self.searchResultsTableView is not a property in a UITableViewController.
Sheehan Alam
I have modified my post, to show how the delegates are wired up in IB.
Sheehan Alam
A: 

I needed to create an instance of a UISearchDisplayController instead of using self.searchDisaplyController.

Sheehan Alam