使用SplitView在UitableView中钻取

时间:2011-03-02 06:32:17

标签: objective-c xcode uisplitviewcontroller ipad

我正在使用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

1 个答案:

答案 0 :(得分:1)

您是否尝试过更改:

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

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