【发布时间】:2011-03-10 17:04:12
【问题描述】:
编辑:添加源项目
--> I uploaded a sample project that clearly shows my dilemma which can be found here <--
我创建了一个基于拆分视图的应用程序。然后,我在 MainWindow.xib 中的 DetailViewController 中添加了第二个 UINavigationController。
然后,当单击工具栏项时,我会弹出一个新的 UIViewController 子类。我使用以下代码进行弹出:
DocumentDetailVC *DetailViewController = [[DocumentDetailVC alloc] initWithNibName:@"DocumentDetailVC" bundle:[NSBundle mainBundle]];
[detailViewController.detailNavController pushViewController:DetailViewController animated:YES];
DocumentsVC *RRequestViewController = [[DocumentsVC alloc] initWithNibName:@"DocumentsVC" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:RRequestViewController animated:YES];
这行得通。我遇到的问题是如何将信息或函数调用从拆分视图的主端传递到拆分视图的详细信息端?
如果我通过以下方法呈现 UIViewController:
DocumentDetailVC *RRequestViewController = [[DocumentDetailVC alloc] initWithNibName:@"DocumentDetailVC" bundle:[NSBundle mainBundle]];
RRequestViewController.delegate=self;
RRequestViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
[RRequestViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:RRequestViewController animated:YES];
[RRequestViewController release];
RRequestViewController = nil;
我能够按预期通过协议完成回访。
DocumentDetailVC,通过pushViewController加载时,层次结构如下:
NSLog([NSString stringWithFormat:@"%@",self]);
//self = <DocumentDetailVC: 0x4e0d960>
NSLog([NSString stringWithFormat:@"%@",self.parentViewController]);
//self.parentViewController = <UINavigationController: 0x4e0ce30>
NSLog([NSString stringWithFormat:@"%@",self.parentViewController.parentViewController]);
//self.parentViewController.parentViewController = <UISplitViewController: 0x4e0d0f0>
感谢您的帮助。这个问题正在消耗我的生命!
--> I uploaded a sample project that clearly shows my dilemma which can be found here <--
【问题讨论】:
标签: iphone uinavigationcontroller uisplitviewcontroller ipad