Iphone 带有多细节视图控制器的UISplitViewController

Iphone 带有多细节视图控制器的UISplitViewController,iphone,xcode,ipad,uisplitviewcontroller,Iphone,Xcode,Ipad,Uisplitviewcontroller,我正在制作一个splitView应用程序,我需要不同的细节视图控制器。我做了很多研究,发现使用Apple MultipledTailView控制器,但它并没有完全被采用,所以任何人都可以使用它。所以有什么方法可以做到这一点吗?这意味着所有人都需要不同的细节视图控制器。嗨,Nazia,我刚刚从中找到了解决方案 你可以这样做:- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDict

我正在制作一个splitView应用程序,我需要不同的细节视图控制器。我做了很多研究,发现使用Apple MultipledTailView控制器,但它并没有完全被采用,所以任何人都可以使用它。所以有什么方法可以做到这一点吗?这意味着所有人都需要不同的细节视图控制器。

嗨,Nazia,我刚刚从中找到了解决方案

你可以这样做:-

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after app launch.
        self.splitViewController =[[UISplitViewController alloc]init];
    self.rootViewController=[[RootViewController alloc]init];
    self.detailViewController=[[FirstDetailViewController alloc]init];

    UINavigationController *rootNav=[[UINavigationController alloc]initWithRootViewController:rootViewController];
    UINavigationController *detailNav=[[UINavigationController alloc]initWithRootViewController:detailViewController];

    self.splitViewController.viewControllers=[NSArray arrayWithObjects:rootNav,detailNav,nil];
    self.splitViewController.delegate=self.detailViewController;

    // Add the split view controller's view to the window and display.
    [window addSubview:self.splitViewController.view];
    [window makeKeyAndVisible];

    return YES;
}

 -(void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    /*
     When a row is selected, set the detail view controller's detail item to the item associated with the selected row.
     */
    NSUInteger row = indexPath.row;
    [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;
    }
    [[self.appDelegate.splitViewController.viewControllers objectAtIndex:1] setViewControllers:viewControllerArray animated:NO];    

    [self.appDelegate.splitViewController viewWillAppear:YES];
    [viewControllerArray release];

 }

您也可以查看此演示

现在两个链接都已关闭。你能提供另一个链接吗@Nitin Gohel创建两个视图控制器FirstDetailViewController和SecondDetailViewController,它们都是详细视图控制器。然后装入一个名为RootViewController的tableview控制器。代码-(void)tableView:(UITableView*)或tableView DidSelectRowatineXpath:(NSIndexPath*)indexPath{}将位于RootViewController上。就这些。