当我点击后退按钮然后我加载一个特定的视图。但是对于那个特定的视图我必须添加一个tabbarController.How我能做到吗??当我尝试添加它时不会被添加..无法理解y ?
-(IBAction)switchtofirst {
AppViewController *first=[[AppViewController alloc] initWithNibName:@"AppViewController" bundle:nil];
Login *second=[[Login alloc]initWithNibName:@"Login" bundle:nil];
second.title=@"Login";
NSArray *viewArray=[[NSArray alloc] initWithObjects: first,second,nil];
tabBarController=[[UITabBarController alloc] init];
[tabBarController setViewControllers:viewArray animated:NO];
AppViewController *gp=[AppViewController alloc];
[gp.view addSubview:tabBarController.view];
[self presentModalViewController:gp animated:NO];
[gp release];
}
答案 0 :(得分:1)
尝试这样的事情:
-(IBAction)switchtofirst {
AppViewController *first = [[AppViewController alloc] initWithNibName:@"AppViewController" bundle:nil];
Login *second=[[Login alloc]initWithNibName:@"Login" bundle:nil];
second.title=@"Login";
NSArray *viewArray= [NSArray arrayWithObjects:first, second, nil];
tabBarController=[[UITabBarController alloc] init];
[tabBarController setViewControllers:viewArray animated:NO];
[self presentViewController:tabBarController animated:YES completion:nil];
}