A页面跳到B页面。用模态切换presentViewController的方式跳转
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:VC];
[self presentViewController:nav animated:YES completion:nil];
这样跳到了B页面。B又跳到了C页面。C又跳到D页面。
用导航控制器入栈的方式切换,代码如下:
[self.navigationController pushViewController:regSecondStepVC animated:YES];
现在问题来了。我要从D页面。直接回到A页面。应该怎么回?
好像这样解决了
[((UIViewController*)weakSelf.navigationController.viewControllers[0]) dismissViewControllerAnimated:YES completion:^{
[[NSNotificationCenter defaultCenter] postNotificationName:NotificationLoginCallBack object:nil];
}];
只是还不算完美。首先切到了B页面,然后B消失,回到了A页面。
如果能从D直接动画切到A。不经过B页面,更完美。不过目前算可用了
希望有更完美的方案
黄舟2017-04-17 17:12:06
I didn’t have time yesterday so I took a seat and answered it casually. After testing it today, the conclusion is:
Directly call the dismissViewControllerAnimated method of self.navigationController.
The animation effect is directly pushed downwards.
迷茫2017-04-17 17:12:06
for (UIViewController *temp in self.navigationController.viewControllers) {
if ([temp isKindOfClass:[AviewController class]]) {
[self.navigationController popToViewController:temp animated:YES];
}
}
PHP中文网2017-04-17 17:12:06
Blogger, I am also working on such a function. Did you finally solve this problem?