我目前正在做具有图形功能的计算器应用程序。那么,我的计算器中有这个按钮,并将它连接到我的 Calculator2ViewController 上。另外,我将此按钮连接到另一个名为 GraphViewController 的 UIViewController 并将 segue 的标识符命名为showGraph
. 下面是我的segue的代码。
- (GraphViewController *)graphViewController {
return [self.splitViewController.viewControllers lastObject];
}
- (IBAction)graphPressed {
if ([self graphViewController]) {
[[self graphViewController] setProgram:self.brain.program];
}
else {
[self performSegueWithIdentifier:@"showGraph" sender:self];
}
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
[segue.destinationViewController setProgram:self.brain.program];
}
在那里,所以没有错误和警告。但是当我尝试运行应用程序并按下Graph
按钮时,应用程序崩溃并在我的控制台上得到它。
2012-06-18 11:08:17.272 Calculator2[1135:f803] -[Calculator2ViewController graphPressed:]: unrecognized selector sent to instance 0x6c38850
2012-06-18 11:08:17.273 Calculator2[1135:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Calculator2ViewController graphPressed:]: unrecognized selector sent to instance 0x6c38850'
请告诉我为什么会发生这种情况以及如何以更好的方式做到这一点。谢谢!
编辑:
更改- (IBAction)graphPressed
为- (IBAction)graphPressed:(id)sender
. 转场现在有效。但是,我的控制台上有这个通知(有点吓人)
2012-06-18 11:30:02.955 Calculator2[1260:f803] nested push animation can result in corrupted navigation bar
2012-06-18 11:30:03.308 Calculator2[1260:f803] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2012-06-18 11:30:03.309 Calculator2[1260:f803] Unbalanced calls to begin/end appearance transitions for <GraphViewController: 0x6e458d0>.