0

对于我的 ipad 应用程序,我有这样的要求

对于根视图中的每一行,我想显示不同的详细视图和

详细视图有一些按钮单击它将显示另一个视图(详细视图需要在导航控制器下)

任何人都可以给我满足此要求的教程/示例代码/视频吗?

我在这里尝试了 20 多个类似的问题并搜索了 youtube,但几乎没有运气。

我有一个链接http://kshitizghimire.com.np/uisplitviewcontroller-multipledetailviews-with-navigation-controller/但是当我们在纵向模式下选择一行时,弹出窗口没有被隐藏有一些问题。

任何帮助,将不胜感激。

谢谢。

PS:我的要求是这样的

根视图
|— 选项 1
|—(用户导航控制器)
| |OPT1_DETAILVIEW
| |– OPT1_DRILLDOWNVIEW1
| |–OPT1_DRILLDOWNVIEW2
| |–等
|— 选项 2
|—(用户导航控制器)
| |OPT2_DETAILVIEW
| |– OPT2_DRILLDOWNVIEW1
| |–等
|— 选项 3 等
4

1 回答 1

1

我的项目也遇到了这个问题。我使用以下代码完成了此操作

您需要做的是,当您点击根视图控制器的 tableview 的任何单元格时,您必须加载适当的视图控制器。

您必须在根视图控制器的 tableview 的 tableViewDidSelectRowaAtIndexPath 部分编写以下代码。

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

    //Load previous controllers array.

    NSMutableArray *viewControllerArray=[[NSMutableArray alloc] initWithArray:splitViewController.viewControllers]; 

    //Remove last Detail View controller Object.

    [viewControllerArray removeLastObject];

    // Check appropirate row value.

    if (indexPath.row == 0) {
        // Add new Detail controller in your array ...
        FirstViewController *fvc=[[[FirstViewController alloc] initWithNibName:@"FirstViewController"  bundle:nil] autorelease];        
        [viewControllerArray addObject:fvc];
    }
    else if (indexPath.row == 1) {
        // Add new Detail controller in your array ...
        SecondViewController *svc=[[[SecondViewController alloc] initWithNibName:@"SecondViewController"  bundle:nil] autorelease];        
        [viewControllerArray addObject:svc];
    }
    // And so on..

    // Set New View Controllers of SplitViewController

    [splitViewController setViewControllers:viewControllerArray];   
    [viewControllerArray release];      
}

我这样做了,它奏效了。我希望它会有所帮助。

于 2012-06-21T12:59:43.943 回答