2021-02-14 09:25 PM
If I have multiple parent views with a single child view, is there any good way to return to the caller parent view from a child view?
My current implementation is to store the current parent view in the model.cpp class before transitioning to child view. When a button (i.e. done) is clicked from the child view, it would then check the last parent view through the model.cpp getLastParentView() and the child view will transition to parent view.
Lastly, the parent view would go through the necessary initialization and behave like any ordinary screen switching.
I wonder if there is a better way to do this, thanks in advance everyone!
2021-12-01 12:43 PM
I was looking for the same answer (sort of). I want to go to one defined screen from two different places, but when I hit the back button on the child screen, I want to return to the correct parent.
2021-12-02 02:40 AM
there isn't (as far as I know). You will have to keep a state variable that stores the parent screen and use that to return to the right one - as you're doring now.
It's a nice idea though. Keep a small array of the last screens you visited so so going back through multiple screens could be possible.