Вопрос

In iOS6, I implemented a search bar for my table view. I was able to select the row in the search results by doing the following:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    if (tableView == self.searchDisplayController.searchResultsTableView) {
        // Perform segue to detail when a SEARCH table cell is touched
        [self performSegueWithIdentifier:@"setPWSDetails:" sender:tableView];
    }
}

In iOS7, when I run my app, and perform a search, the same function gets called, but the condition: tableView == self.searchDisplayController.searchResultsTableView is not getting met. Is there something I am missing or something else I need to do in the storyboard or code.

Thank you...Amro

Это было полезно?

Решение

Hopefully this will benefit others who ran into the same issue that I did. I let Xcode automatically upgrade my storyboard from ios6 to 7. This generated a lot of warnings and I opted to just make the storyboard from scratch with the exception being the view controller that included my uisearchbar because it was the only one without any warnings. Well it bit me at run time as described above.

To fix it, I deleted the search bar and deleted the Search Display Controller. Its the yellow circle with what looks like a search bar in the circle. You should delete it otherwise if you add search bars, you end up with a bunch of these yellow circles and you can mistakingly connect the wrong one in my opinion.

enter image description here

I then readied the search bar and connected it accordingly and voila, the code worked again.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top