Receiver () has no segue with identifier 'secondViewControllerSegue`

自闭症网瘾萝莉.ら 提交于 2019-12-11 11:24:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!