编辑:添加源项目splitViewController配有两张NavigationController连接协议
--> 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];
这是有效的。我遇到的问题是如何将信息或函数调用从Split View的Main一侧传递到Split视图的Detail一侧?
如果通过以下方法呈现的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 <--
请关闭大写锁定。 – 2011-04-27 17:29:56