【发布时间】:2014-08-26 15:25:27
【问题描述】:
我不完全确定为什么会收到此错误。当我单击 FirstViewController 上的按钮时会发生这种情况:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FirstViewController 1ButtonPress:]: unrecognized selector sent to instance 0x10954bbd0'
我的 FirstViewController 有一个按钮 (1ButtonPress),它与另一个具有嵌入 NavigationController 的 ViewController 执行转场(所以在我的故事板中,转场是从 FirstViewController 到 NavigationController)。在这个 segue 中,一些数据通过以下方式传输到另一个 ViewController:
First.m
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"abc"]) {
UINavigationController *navController = [segue destinationViewController];
SecondViewController *BVC = (SecondViewController *)(navController.topViewController);
BVC.BLLImg = [UIImage imageNamed:@"SomeImage.jpg"];
BVC.BLLTitle = @"SomeText";
}
}
segue 在情节提要中具有标识符“abc”。环顾四周,我认为这与不正确的课程有关,但第一次检查时一切看起来都很好。
我会收到此错误的任何其他原因?
【问题讨论】:
-
你能展示一下
1ButtonPress的实现吗
标签: ios objective-c uibutton unrecognized-selector