我每个都有四到五个视图控制器,它显示不完整的实现下面是一个视图控制器
#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
实施
#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