开发者

Getting error that method is not defined

I have a subview that is linking to a detail subview. See below. This .h is EXACTLY the same in the two header files I am currently using, except for the @interface _ (JohnAdams on one and GeorgeWashington on the other.

@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

However, take a look at the two .m's

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

}

In John Adams.m, rather than loading WebView3 and WebView4, it loads WebView1 and WebView2. Additionally, John Adams.m receives a warning that method definition for both -wikiButtonPressed and bioButtonPressed are undefined (but not on GeorgeWashington.m). What am I doing wrong?


Are you using the interface builder? (Apparently you do because you are declaring IBOutlets)

If so then check the class name of the files owner of JohnAdams.xib.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜