我有UISplitView与许多detailViewControllers它工作正常但问题是当我从任何detailViewController移动到LoginViewController然后回来然后我想要UIsplitViewController应该有detailView控制器,这是firstViewController
这里是tableView为RootViewController做了select方法
[self.appDelegate.splitViewController viewWillDisappear:YES];
NSMutableArray *viewControllerArray=[[NSMutableArray alloc] initWithArray:[[self.appDelegate.splitViewController.viewControllers objectAtIndex:1] viewControllers]];
[viewControllerArray removeLastObject];
if (row == 0) {
self.firstDetailViewController=[[[FirstDetailViewController alloc] init]autorelease];
[viewControllerArray addObject:self.firstDetailViewController];
self.appDelegate.splitViewController.delegate = self.firstDetailViewController;
}
if (row == 1) {
self.secondDetailViewController=[[[SecondDetailViewController alloc]init]autorelease];
[viewControllerArray addObject:self.secondDetailViewController];
self.appDelegate.splitViewController.delegate = self.secondDetailViewController;
}
if (row == 2) {
self.myLearningViewController=[[[MyLearningViewController alloc]init]autorelease];
[viewControllerArray addObject:self.myLearningViewController];
self.appDelegate.splitViewController.delegate = self.myLearningViewController;
}
if (row == 3) {
self.communityViewController=[[[CommunityViewController alloc]init]autorelease];
[viewControllerArray addObject:self.communityViewController];
self.appDelegate.splitViewController.delegate = self.communityViewController;
}
if (row == 4) {
self.reportsViewController=[[[ReportsViewController alloc]init]autorelease];
[viewControllerArray addObject:self.reportsViewController];
self.appDelegate.splitViewController.delegate = self.reportsViewController;
}
if (row == 5) {
self.walkInViewController=[[[WalkInViewController alloc]init]autorelease];
[viewControllerArray addObject:self.walkInViewController];
//self.appDelegate.splitViewController.delegate = self.secondDetailViewController;
self.appDelegate.splitViewController.delegate = self.walkInViewController;
}
if (row == 6) {
self.postDataViewController=[[[PostDataViewController alloc]init]autorelease];
[viewControllerArray addObject:self.postDataViewController];
self.appDelegate.splitViewController.delegate = self.postDataViewController;
}
[[self.appDelegate.splitViewController.viewControllers objectAtIndex:1] setViewControllers:viewControllerArray animated:NO];
[self.appDelegate.splitViewController viewWillAppear:YES];
[viewControllerArray release];
我想点击登录按钮然后将rootViewCOntroller的detailViewController设置为firstDetailViewController
-(IBAction)loginButton{
}
答案 0 :(得分:0)
返回登录
appDelegate.window.rootViewController=appDelegate.self.loginviewcontroller;
[appDelegate.window makeKeyAndVisible];
登录到detailviewcontroller正在为你工作