我有四到五个视图控制器,每个都显示不完整的实现 一个ViewController在
下面#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "CereniaAppDelegate.h"
@interface MainViewController : UIViewController <UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource>{
IBOutlet UIButton*homeButton;
IBOutlet UIButton*economicDataButton;
IBOutlet UIButton*riskButton;
IBOutlet UIButton*financialImpactButton;
IBOutlet UIButton*probabilitiesButton;
IBOutlet UIButton*enterButton;
}
-(IBAction)enterButtonAction;
-(IBAction)homeButtonAction;
-(IBAction)economicDataButtonAction;
-(IBAction)riskButtonAction;
-(IBAction)financialImpactButtonAction;
-(IBAction)probabilitiesButtonAction;
@end
Implementaion
#import "MainViewController.h"
#import "EconomicDataViewController.h"
#import "ProbabilitiesViewController.h"
#import "RiskViewController.h"
#import "FinancialImpactViewController.h"
@implementation MainViewController
-(IBAction)homeButtonAction{
}
-(IBAction)enterButtonAction{
EconomicDataViewController*targetContrlloer=[[EconomicDataViewController alloc] init];
[self.navigationController pushViewController:targetContrlloer animated:YES];
}
-(IBAction)economicDataButtonAction{
EconomicDataViewController*targetContrlloer=[[EconomicDataViewController alloc] init];
[self.navigationController pushViewController:targetContrlloer animated:YES];
}
-(IBAction)riskButtonAction{
RiskViewController*targetContrlloer=[[RiskViewController alloc] init];
[self.navigationController pushViewController:targetContrlloer animated:YES];
}
-(IBAction)financialImpactButtonAction{
FinancialImpactViewController*targetContrlloer=[[FinancialImpactViewController alloc] init];
[self.navigationController pushViewController:targetContrlloer animated:YES];
}
-(IBAction)probabilitiesButtonAction{
ProbabilitiesViewController*targetContrlloer=[[ProbabilitiesViewController alloc] init];
[self.navigationController pushViewController:targetContrlloer animated:YES];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
return YES;
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
- (BOOL)shouldAutorotateToInterfaceOrientation(UIInterfaceOrientation)interfaceOrientation {
// return YES;
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
[super viewDidUnload];
}
- (void)dealloc {
[super dealloc];
[homeButton release];
[economicDataButton release];
[riskButton release];
[probabilitiesButton release];
[enterButton release];
}
@end
答案 0 :(得分:1)
这是因为你没有为UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource实现委托方法。这样做,错误应该消失。
答案 1 :(得分:0)
制作你拥有的所有UIButton的属性,并在你的.m文件中@synthesize它。
像:
MainViewController.h
@interface MainViewController : UIViewController <UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource>{
UIButton*homeButton;
}
@property(nonatomic,retain) IBOutlet UIButton *homeButton;
MainViewController.m
@synthesize homeButton;