UINavigationController导航控制器弹出(pop)和压入(push)的顺序问题

项目中遇到的情况,无暇细述,略记以备后用.


在使用UINavigationController进行viewController管理的时候,需要先弹出一个页面,然后再推入另一个页面,但是需要显示弹出效果:

代码如此则可能之后会出错(Unbalanced calls to begin/end appearance transitions for):

    [self.navigationController popViewControllerAnimated:YES];

    [self.navigationController pushViewController:vc animated:NO];


换个顺序则不会报错,但是页面效果不如预期:

    [self.navigationController popViewControllerAnimated:NO];

    [self.navigationController pushViewController:vc animated:YES];


由此猜测,当animated参数为YES时,需要等动画完成,才会真正完成下一步push或pop.待高手告知.


你可能感兴趣的:(UINavigationController导航控制器弹出(pop)和压入(push)的顺序问题)