我想使用 Storyboard 在 ViewControllers 之间传递信息,但出现错误...我的代码如下
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([[segue identifier] isEqualToString:@"ToAssistance"])
{
NSLog(@"To assistance");
}
else if([[segue identifier] isEqualToString:@"ToMap"])
{
UINavigationController * navController = (UINavigationController *)[segue destinationViewController];
EventMapViewController * eventMapViewController = (EventMapViewController *)[navController topViewController];
}
}
但在一线
EventMapViewController * eventMapViewController = (EventMapViewController *)[navController topViewController];
我得到以下异常
2012-04-23 19:49:00.369 StoryboardAssistance[9916:11603]
-[EventMapViewController topViewController]: unrecognized selector sent to instance 0x6e86380 2012-04-23 19:49:00.370 StoryboardAssistance[9916:11603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[EventMapViewController topViewController]: unrecognized selector sent to instance 0x6e86380'
*** First throw call stack: (0x135b022 0x2037cd6 0x135ccbd 0x12c1ed0 0x12c1cb2 0x546a 0x5424be 0x135ce99 0x11a14e 0x11a0e6 0x1c0ade 0x1c0fa7 0x1c0266 0x13f3c0 0x13f5e6 0x125dc4 0x119634 0x15fdef5 0x132f195 0x1293ff2 0x12928da 0x1291d84 0x1291c9b 0x15fc7d8 0x15fc88a 0x117626 0x218d 0x20f5) terminate called throwing an exception(lldb)
有什么建议么?