关闭 viewController 从 2 模态演示到特定 viewController

Dismiss a viewController from 2 modal presentation to especific viewController

我有下一个

我想 将我的 vc3 关闭到 vc2 问题是它是由 vc1 呈现的,所以当我执行 dismissViewController它 returns 到 VC1,在从 vc1 到 vc3 的导航中我从不实例化或显示 Vc2

有什么想法吗?

创建一个委托方法,当您关闭 VC3 时调用该方法,因此当委托传递给 VC1 时推送 VC2

试试这个:-

 NSMutableArray *navigationArray = [[NSMutableArray alloc] initWithArray: self.navigationController.viewControllers];

// [navigationArray removeAllObjects];    // This is just for remove all view controller from navigation stack.
MyFansViewController *vc3 = [[MyFansViewController alloc] init];
[navigationArray removeObjectAtIndex: 2]; // You can pass your index here
[navigationArray addObject:vc3];
self.navigationController.viewControllers = navigationArray;

我没有测试过,但经过一些修改就可以了