获取错误,该方法未定义

问题描述:

我有一个链接到详细子视图的子视图。见下文。这.H恰恰是在我目前使用两个头文件相同,除了@interface _(上一个和乔治·华盛顿约翰·亚当斯在其他。获取错误,该方法未定义

@interface JohnAdams : UIViewController { 

NSString *selectedCountry; 
IBOutlet UIButton *bio; 
IBOutlet UIButton *wiki; 
} 
@property (nonatomic, retain) NSString *selectedCountry; 
@property (nonatomic, retain) UIButton *wiki; 
@property (nonatomic, retain) UIButton *bio; 

-(IBAction)wikiButtonPressed:(id)sender; 
-(IBAction)bioButtonPressed:(id)sender; 
@end 

但是,看一看两个.M的

//George Washington.m 
-(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]; 
} 

//JohnAdams.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]; 

} 

在约翰Adams.m,而不是装载WebView3和WebView4,它加载WebView1和WebView2。此外,约翰Adams.m收到一个警告,方法定义为两个-wikiButtonPressed和bioButtonPressed未定义(但不在GeorgeWashington.m上)我做错了?

+0

因此,当JohnAdams生物按钮被按下时,执行不会输入JohnAdams.m中的代码?如果是这种情况,则xib可能与错误的控制器相关联。 –

您使用的是界面生成器吗? (显然,你这样做,因为您声明IBOutlets)

如果是这样,然后检查JohnAdams.xib的文件所有者的类名。