How can I pop a view from a UINavigationController and replace it with another in one operation?

后端 未结 16 2172
谎友^
谎友^ 2020-11-27 10:01

I have an application where I need to remove one view from the stack of a UINavigationController and replace it with another. The situation is that the first view creates an

16条回答
  •  离开以前
    2020-11-27 10:23

    I use this solution to keep the animation.

    [self.navigationController pushViewController:controller animated:YES];
    NSMutableArray *newControllers = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
    [newControllers removeObject:newControllers[newControllers.count - 2]];
    [self.navigationController setViewControllers:newControllers];
    

提交回复
热议问题