self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
@implementation LoginViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *button =[UIButton buttonWithType:UIButtonTypeSystem];
[button setTitle:@"登陆" forState:UIControlStateNormal];
button.backgroundColor=[UIColor redColor];
button.frame =CGRectMake(100, 100, 60, 60);
[button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
}
-(void)btnClick:(UIButton *)button{
AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
FirstViewController *control =[[FirstViewController alloc]init];
UITabBarItem *item = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemMostViewed tag:100];
control.tabBarItem = item;
SecondViewController *control2 =[[SecondViewController alloc]init];
UITabBarItem *item2 = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemTopRated tag:100];
control2.tabBarItem = item2;
UITabBarController *tabController = [[UITabBarController alloc] init];
tabController.viewControllers =@[control,control2];
appDelegate.window.rootViewController = tabController;
}