我有一个segue的问题。我有" next"按钮:
- (IBAction)NextButton:(id)sender {
//...
[self performSegueWithIdentifier:@"adaugaScore" sender:self];
}
和此:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([[segue identifier] isEqualToString:@"adaugaScore"])
{
ScoreViewController *scoreVC = segue.destinationViewController;
scoreVC.score = [NSString stringWithFormat:@"%d",score];
}
}
我的应用程序在此行崩溃:
[self performSegueWithIdentifier:@"adaugaScore" sender:self];
出现此错误:
has no segue with identifier 'adaugaScore''
答案 0 :(得分:0)
您需要在故事板中将故事板ID /名称(adaugaScore)设置为您的控制器。检查:What is a StoryBoard ID and how can i use this?了解更多信息。
编辑: 要使用segue名称,请参阅:How do i set a modal segue (programmatically) to a push segue
答案 1 :(得分:0)
将segue.identifier设置为adaugaScore。这可以通过单击segue并在属性面板中设置标识符来完成。