Reputation: 1654
I've got an issue with segues. My UITableViewController has two segues to other UITableViewControllers. The segues linked from controller to controller, not from cell to controller.
code:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
if([segue.identifier isEqualToString:@"segueOne"])
{
//implementation omitted
}
if([segue.identifier isEqualToString:@"segueTwo"])
{
//implementation omitted
}
}
The evil place:
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(self.navigationKey==1)
{
[self performSegueWithIdentifier:@"segueOne" sender:self];
}
if(self.navigationKey==2 || self.navigationKey==3)
{
[self performSegueWithIdentifier:@"segueTwo" sender:self];
}
}
Generally, the navigation works. Definitely, the problem is that navigation doesn't work on firstly selected cell. Any help is much appreciated.
Upvotes: 1
Views: 1410
Reputation: 81
You are using tableView:did*Deselect*RowAtIndexPath:
instead of
tableView:did*Select*RowAtIndexPath:
Hope this helps,
Upvotes: 5