Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在显示模态视图控制器后推送导航控制器_Ios_Uiviewcontroller_Uinavigationcontroller_Uitabview - Fatal编程技术网

Ios 在显示模态视图控制器后推送导航控制器

Ios 在显示模态视图控制器后推送导航控制器,ios,uiviewcontroller,uinavigationcontroller,uitabview,Ios,Uiviewcontroller,Uinavigationcontroller,Uitabview,我有一个选项卡视图控制器,它有一个类似于这样的按钮,当它被按下时,会出现一个模式: PostViewController *post = [[PostViewController alloc] init]; // [self.navigationController pushViewController:post animated:YES]; // Presentation [self presentViewController:post animated:YES completion:ni

我有一个选项卡视图控制器,它有一个类似于这样的按钮,当它被按下时,会出现一个模式:

PostViewController *post = [[PostViewController alloc] init];

// [self.navigationController pushViewController:post animated:YES];

// Presentation
[self presentViewController:post animated:YES completion:nil];
模式完成后,我希望将其关闭,并按如下方式推送一个新的视图控制器:

ProfilesViewController *profile = [[ProfilesViewController alloc] init];
[self.navigationController pushViewController:profile animated:YES];

但我不能在后vc中这样做,因为这是一种模式。如何执行此操作?

您可以尝试使用
completionBlock

完成presentViewController后,将调用
CompletionBlock

PostViewController *post = [[PostViewController alloc] init];
[con presentViewController:post animated:YES completion:^{
    ProfilesViewController *profile = [[ProfilesViewController alloc] init];
    [self.navigationController pushViewController:profile animated:YES];
}];
有关
presentViewController:animated:completion:

完成:演示文稿完成后要执行的块。 此块没有返回值,也不接受任何参数。你可以 为此参数指定nil


选项卡视图控制器是否嵌入到UINavigationController中?
如果没有,您当然不能使用self.navigationController。

好的,它会将其推到模式后面?它会推到navigationController堆栈中。如果您想在之前取消模式,您可以使用completionBlock添加
dismissViewControllerAnimated:completion:
,再问一个问题,一旦我关闭post,post数据能否显示在ProfilesViewController中?可见时,纵断面图控制器是否运行?当您关闭ViewController时,它会释放内部的所有数据。因此,您必须向新VC提供所有要保留的参数。希望这能回答你的问题,为什么你需要在出现之前展示一些东西并将其摒弃?