尝试推送mapViewController时出错

时间:2012-03-27 16:24:28

标签: objective-c xcode uiviewcontroller plist

-(IBAction)flipView:(id)sender
{
    MapController *nextVC = [[MapController alloc] initWithNibName:@"MapController" bundle:nil];
    nextVC.title = @"Map";
    nextVC.longi = [self.subject valueForKey:@"LongiS"];
    nextVC.lati = [self.subject valueForKey:@"LatiS"];

    [self.navigationController pushViewController:nextVC animated:YES];
}

这是错误: 2012-03-27 19:19:44.896 pop [6941:11603] - [DetailViewController flipView]:无法识别的选择器发送到实例0x6d87b90 2012-03-27 19:19:44.936 pop [6941:11603] *由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [DetailViewController flipView]:无法识别的选择器发送到实例0x6d87b90' * 第一次抛出调用堆栈: (0x189e052 0x16bed0a 0x189fced 0x1804f00 0x1804ce2 0x189fec9 0x4965c2 0x6d1d54 0x189fec9 0x4965c2 0x49655a 0x53bb76 0x53c03f 0x53b2fe 0x4bba30 0x4bbc56 0x4a2384 0x495aa9 0x16a1fa9 0x18721c5 0x17d7022 0x17d590a 0x17d4db4 0x17d4ccb 0x16a0879 0x16a093e 0x493a9b 0x2e90 0x26b5)

按下flipView按钮时,应用程序崩溃..

1 个答案:

答案 0 :(得分:1)

将冒号添加到flipView选择器:

UIBarButtonItem *flipButton = [[UIBarButtonItem alloc] initWithTitle:@"Map" 
                                                               style:UIBarButtonItemStyleBordered 
                                                              target:self
                                                              action:@selector(flipView:)];
self.navigationItem.rightBarButtonItem = flipButton; 

如果您不使用IB,请将IBAction更改为void