views:

493

answers:

1

I have a UITableViewController subclass that renders a list of pre-set categories and fetches a list of sites/urls for each of them. I want to add a search capability that would allow to search by a site name.

What I want is to have a usual search interface, that would start a search thread (that would fetch and process results) and then show it in the table. I've modified my table delegate to return custom set of cells if the tableView is not the one form xib (i.e. it's a search table view):

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"RSSCatalogCell";

    if(tableView != self.tableView)
        return [searchController tableView:tableView cellForRowAtIndexPath:indexPath];

    // ... usual cell initialization for categories
}

As soon as my network thread (spawned from searchBarSearchButtonClicked:) finishes, it asks a search controller table to reload the data:

if(searchDisplayController.active)
    [searchDisplayController.searchResultsTableView reloadData];

But I still see the old table (with catalog entires), however it seem to ignore touches.

+1  A: 

Ok, I've solved it (I hate that when you clearly write a question to some public group/forum you might quickly find your own bug after spending several days looking for it).

The problem was in one wrong connection in XIB, the above code is working perfectly.

Farcaller