【发布时间】:2012-09-29 22:31:14
【问题描述】:
我有一个主视图控制器并正在呈现一个子视图。对于孩子内部的其中一项设置,我需要再次调用主视图控制器。它只会让事情变得更容易。
以下导致层次结构问题:
#define appDelegate (MyAppDelegate *)[[UIApplication sharedApplication] delegate]
[self presentViewController:[appDelegate mainViewController] animated:YES completion:^{}];
有没有什么方法可以方便的调用mainViewController而不丢失子view的状态?
编辑
这是我展示子视图的方式。
ChildViewController *childViewController = [[ChildViewController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:childViewController];
[childViewController release];
[self presentModalViewController:navigationController animated:NO];
[navigationController release];
【问题讨论】:
-
就不能新建一个parentView并推送给child吗?
-
@KassemBagher 是的,这是一个选项,这将非常非常不方便,因为需要进行大量初始化
标签: ios uiviewcontroller