У меня TableViewСontroller c uisearchbarом
и такой код! И indexPath всегда пустой! в чем может быть проблема
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"Detail"]) {
SearchDetails *DetailViewController = [segue destinationViewController];
if(sender == self.searchDisplayController.searchResultsTableView) {
NSIndexPath *indexPath = [self.searchDisplayController.searchResultsTableView indexPathForSelectedRow];
NSString *destinationTitle = [self.searchResults objectAtIndex:[indexPath row]];
[DetailViewController setTitle:destinationTitle];
int searchIndex = [self.strings indexOfObject:destinationTitle];
self.needValue = searchIndex;
[DetailViewController setNeedValue: _needValue];
}
else {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSString *destinationTitle = [self.strings objectAtIndex:[indexPath row]];
[DetailViewController setTitle:destinationTitle];
self.needValue = [indexPath row];
[DetailViewController setNeedValue: _needValue];
}
}
}