【发布时间】:2016-04-11 07:53:34
【问题描述】:
我的应用导航如下:
NavigationController ---> RootViewController --(Show Segue)-> SomeViewController --(Show Segue)-> ParentViewController (With ContainerView)
所以,ParentViewController 有一个容器视图。 此容器视图在运行时以编程方式填充,具体取决于用户选择。 所以,基本上视图层次结构是这样的:
ParentViewController (With ContainerView) ---(Embed Segue) --> ContainerViewController --(Custom Segue,用于决定在运行时显示哪个子节点) ---> FirstChildViewController/SecondChildViewController
现在,当在 SecondChildViewController 中点击一个按钮时,我会显示一个模式视图。到目前为止一切都很好。
但是,现在我想在关闭 ModalViewController 时更新 SecondChildViewController 中的数据。我尝试在 ModalViewController 中这样做:
SecondChildViewController *secondChildVC = (SecondChildViewController *)self.presentingViewController;
[self dismissViewControllerAnimated:YES completion: ^{ [secondChildVC updateList]; }];
但是,我收到以下错误:
由于未捕获的异常而终止应用程序 'NSInvalidArgumentException',原因:'-[UINavigationController updateList]:发送到实例的无法识别的选择器 0x127e451b0'
我该如何解决这个问题?那么,具体来说,我怎样才能得到“真实的”presentingViewController?我知道它的导航有点奇怪,而且从用户体验的角度来看,视图堆叠太多,但这是客户想要实现的方式。
【问题讨论】:
标签: ios objective-c iphone segue uistoryboard