流程:A->B->模态C->D->F
之前栈中都是一个个push过来的,现在业务需求需要弹出模态视图C,然后点击模态视图中的按钮push到其他页面,本人之前的想法是把模态C当作新的栈
QkMatchDocViewController *viewController = [[QkMatchDocViewController alloc] initWithNibName:@"QkMatchDocViewController" bundle:nil];
viewController.userInfo = content;
UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:viewController];
[self presentModalViewController:navi animated:YES];
这样就能push过去,同时新的问题来了:
[self.navigationController popToRootViewControllerAnimated:YES];
回首页就会回答模态视图C,正确的流程是pop到A视图,我想先关闭模态,在用通知的机制去B视图pop,但是后来因为考虑到业务流程,觉得这个方法不可行。
请问各位大神,指点下其他的方法。
我觉得你的流程有问题,正确的流程是:<从模态视图push时,先关闭模态,然后在原先navigation的流程下push>。而不是在模态上push,因为模态本身就是开辟了一个新的navigation。如果你要push的东西走原来的navigation流程,那就按照我说的做。
关闭模态视图
[self dismissModalViewControllerAnimated:YES];
获取当前的nav栈中viewcontroller,调用
((UINavigationController *)_window.rootViewController).visibleViewController
or
((UINavigationController *)_window.rootViewController).topViewController
push到你要到的视图去