使用 SplitView 在 UitableView 中进行钻取

发布于 2024-10-20 00:56:16 字数 1701 浏览 3 评论 0原文

我正在使用 SplitView 模板在 UITableView 中创建钻取,就像在邮件中完成的那样。根据教程,我创建了适用于基于导航的模板的代码。
我尝试将其修改为分割视图模板。

    (void)tableView:(UITableView *)TableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//Get the dictionary of the selected data source.
        NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
//Get the children of the present item.
        NSArray *Children = [dictionary objectForKey:@"Children"];
        if([Children count] == 0) {
        detailViewController.detailItem = [dictionary objectForKey:@"Title"];
        }
        else {

                  //Prepare to tableview.
                  RootViewController *rvController = [[RootViewController alloc]initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]
                  //Increment the Current View
                  rvController.CurrentLevel += 1;
                  //Set the title;
                  rvController.CurrentTitle = [dictionary objectForKey:@"Title"];
                  //Push the new table view on the stack
                 [COLOR="Red"][B] [self.navigationController pushViewController:rvController animated:YES];[/B][/COLOR]
        rvController.tableDataSource = Children;
                  [rvController release];
        }
}

我该如何更改代码?红线使代码崩溃。如何更改我的代码


我已经解决了我的查询,我正在附加示例应用程序,如果有人想要实现相同的目标,那么我的解决方案会将他们指向某个路径,这里是 iPhone 应用程序的链接

http://www.mediafire.com/?nszdqqdht9ceakb

iPad SplitView 应用程序:http://www.mediafire.com/?861jggve88o8tp8

I am creating a drilldown in UITableView using SplitView Template as done in mail. From a tutorial I created the code that worked fine for a navigation based template.
I tried to modify it for a split view template.

    (void)tableView:(UITableView *)TableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//Get the dictionary of the selected data source.
        NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
//Get the children of the present item.
        NSArray *Children = [dictionary objectForKey:@"Children"];
        if([Children count] == 0) {
        detailViewController.detailItem = [dictionary objectForKey:@"Title"];
        }
        else {

                  //Prepare to tableview.
                  RootViewController *rvController = [[RootViewController alloc]initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]
                  //Increment the Current View
                  rvController.CurrentLevel += 1;
                  //Set the title;
                  rvController.CurrentTitle = [dictionary objectForKey:@"Title"];
                  //Push the new table view on the stack
                 [COLOR="Red"][B] [self.navigationController pushViewController:rvController animated:YES];[/B][/COLOR]
        rvController.tableDataSource = Children;
                  [rvController release];
        }
}

How do I have to change the code? The Line in Red is Crashing the Code. How do I Change my Code


I have solved my Query i am attaching the sample application if anybody want to achieve the same thing then my solution will point them at some path here is the link of the

iPhone Application : http://www.mediafire.com/?nszdqqdht9ceakb

iPad SplitView Application : http://www.mediafire.com/?861jggve88o8tp8

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凤舞天涯 2024-10-27 00:56:17

您是否尝试更改

[self.navigationController pushViewController:rvController animated:YES]; 

[self.navigationController pushViewController:rvController animated:YES];

Did you try changing:

[self.navigationController pushViewController:rvController animated:YES]; 

to

[self.navigationController pushViewController:rvController animated:YES];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文