M
M
MagoVinch2014-02-07 14:04:03
Objective-C
MagoVinch, 2014-02-07 14:04:03

What could be the reason if the TableView does not return the index of the selected cell?

I have a TableViewController with a uisearchbar
and this code! And indexPath is always empty! what could be the problem

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if (;
            [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];
        }
        
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question