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

后端 未结 16 2209
谎友^
谎友^ 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:40

    Not exactly the answer but might be of help in some scenarios (mine for example):

    If you need to pop viewcontroller C and go to B (out of stack) instead of A (the one bellow C), it's possible to push B before C, and have all 3 on the stack. By keeping the B push invisible, and by choosing whether to pop only C or C and B altogether, you can achieve the same effect.

    initial problem A -> C (I want to pop C and show B, out of stack)

    possible solution A -> B (pushed invisible) -> C (when I pop C, I choose to show B or also pop it)

提交回复
热议问题