问题
I have a custom tableview cell in xib file. I am using this custom cell in my FirstViewController. I want to show SecondViewController on didSelectRowAtIndexPath of first viewController.
And I am performing segue in didSelectRowAtIndexPath like
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"secondViewControllerSegue" sender:indexPath];
}
I am getting error saying -
'Receiver () has no segue with identifier 'secondViewControllerSegue''
What am I missing here?
回答1:
Go to your storyboard and Ctrl+Drag from the first view controller (the yellow icon of the first view controller) to the second to create a segue. Then on the left panel go to attributes inspector tab and set an identifier for your segue. Then just set the same identifier in your performSegue
method.
回答2:
You have to connect a segue from firstViewcontroller to secondviewcontroller with the name you are using for segue.
And stroyboard id is not for segue it is for identifying controller in the the storyboard. You have to create segue between you first and second view controller the rest of you code is fine.
来源:https://stackoverflow.com/questions/36100246/receiver-has-no-segue-with-identifier-secondviewcontrollersegue