我有一个导航 Controller A,我在其上推送 View Controller B。我从 B 模态地呈现 View Controller C。我需要同时关闭 C 和弹出 B。我想按顺序进行,首先保持关闭动画,然后是从 B 到 A 的弹出动画。我尝试了这段代码但没有成功:
[self dismissViewControllerAnimated:YES completion:^{
[self.presentingViewController.navigationController popViewControllerAnimated:YES];
}];
关于如何实现这一点的任何建议?
Best Answer-推荐答案 strong>
如果您使用 C viewcontoller 编写,那么:
UIViewController *pvc = self.presentingViewController;
UINavigationController *navController = [pvc isKindOfClass:[UINavigationController class]] ? (UINavigationController *)pvc : pvc.navigationController;
[self dismissViewControllerAnimated:YES completion:^{
[navController popViewControllerAnimated:YES];
}];
或者如果在B View Controller 中
[self.presentedViewController dismissViewControllerAnimated:YES completion:^{
[self.navigationController popViewControllerAnimated:YES];
}];
关于ios - 关闭后弹出 View Controller ,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/26489074/
|