我有一个列表的应用程序。当您点击列表项时,它会为该单元格专门加载一个单独的笔尖。这个第二个笔尖有两个按钮,每个按钮与另一个nib文件相关联。在我的Cell1.m文件中第一次实现此代码可以正常打开nib响应在详细视图中按下的按钮,没有错误/热情:
-(IBAction)wikibuttonPressed:(id)sender {
WebView1 *detailvc = [[WebView1 alloc] initWithNibName:@"WebView1" bundle:nil];
[detailvc setTitle:@"Wikipedia"];
[self.navigationController pushViewController:detailvc animated:YES];
[detailvc release];
}
-(IBAction)biobuttonPressed:(id)sender {
WebView2 *detailvc2 = [[WebView2 alloc] initWithNibName:@"WebView2" bundle:nil];
[detailvc2 setTitle:@"The White House"];
[self.navigationController pushViewController:detailvc2 animated:YES];
[detailvc2 release];
}
但是,当我尝试在Cell2.m上实现此代码时,而不是加载它:
-(IBAction)biobuttonPressed:(id)sender {
WebView4 *detailvc4 = [[WebView4 alloc] initWithNibName:@"WebView4" bundle:nil];
[detailvc4 setTitle:@"The White House"];
[self.navigationController pushViewController:detailvc4 animated:YES];
[detailvc4 release];
}
-(IBAction)wikibuttonPressed:(id)sender {
WebView3 *detailvc3 = [[WebView3 alloc] initWithNibName:@"WebView3" bundle:nil];
[detailvc3 setTitle:@"Wikipedia"];
[self.navigationController pushViewController:detailvc3 animated:YES];
[detailvc3 release];
}
它加载我的第一段代码(WebView1& WebView2,而不是WebView3和WebView4)中关联的nib文件。另外,我收到Cell2.m的警告说没有定义bioButtonPressed和wikiButtonPressed。我做错了什么?
答案 0 :(得分:0)
检查这些方法的定义是否与Cell2.h匹配,以及是否正确设置了出口。