【发布时间】:2017-01-22 13:56:12
【问题描述】:
我有一个 firstViewController 用
显示[self.navigationController pushViewController:firstViewController animated:true];
然后,当单击第一个 VC 中的一个按钮时,我会呈现第二个:
[self presentViewController:secondViewController animated:true completion:nil];
从第二个开始,我将第三个 VC 呈现为模态:
[thirdVC modalPresentationStyle];
[thirdVC setModalPresentationStyle:UIModalPresentationOverCurrentContext];
[self presentViewController:thirdVC animated:true completion:nil];
问题是我想在单击最后一个 VC 的验证按钮时显示第一个 VC。所以我不得不解雇第三个和第二个。我在validateAction(在第三个VC)中试过这个:
[[self parentViewController] dismissViewControllerAnimated:true completion:nil];
[self dismissViewControllerAnimated:true completion:nil];
但是结果是第三个VC(模态的)被解除了,从调试器中我可以看到第一个VC被第二个VC覆盖了。
如何同时解雇第二个和第三个 VC 以返回第一个? 注意:我想在解雇其他人后推送 firstVC,因为我必须重新加载数据(在 fristVC viewDidLoad 中)
【问题讨论】:
-
你可以尝试调用
[self dismissViewControllerAnimated:true completion:nil]; [self dismissViewControllerAnimated:true completion:nil];两次,一次是为了关闭第三个VC,第二次是为了关闭socondVC。
标签: ios objective-c uiviewcontroller