干了件,吃力不讨好的事情。。。
优化界面之间的无限互相跳转,逻辑是优化了!手贱,修改了界面间的跳转的方式,导致跳转无效
- (void)registerButtonClicked
{
//判断该页面是否来自注册页面
if (self.fromRegisterVC) {
[self dismissViewControllerAnimated:YES completion:nil];
}else {
RegisterRootViewController *registerRootVC = [RegisterRootViewController shareInstance];
registerRootVC.fromLoginVC = YES;
[self.navigationController presentViewController:registerRootVC animated:YES completion:nil];
}
}
下面这种修改,在注册页面才能push跳转,上面的代码导致self.navigationController = nil了
解决办法两种
- 继续push,继续入栈
- 模态一个新的nav
我用了前者,解决这个问题!!
- (void)registerButtonClicked
{
//判断该页面是否来自注册页面
if (self.fromRegisterVC) {
[self dismissViewControllerAnimated:YES completion:nil];
}else {
RegisterRootViewController *registerRootVC = [RegisterRootViewController shareInstance];
registerRootVC.fromLoginVC = YES;
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:registerRootVC];
[self.navigationController presentViewController:nav animated:YES completion:nil];
}
}