Your code creates a new instance of the view that has never been pushed onto the stack, then tries to return to that controller.
If you return to the root view controller, you can use popToRootViewControllerAnimated:
If you select a known distance, you can call popViewControllerAnimated: more than once. In your example, it will be 2 controllers, therefore for calls. You can do the same by looking at viewControllers for controller 2 from the end and swimming towards it.
The above suggestions are quick fixes. One of the most effective scenarios will be the transition of the controller that you want to return to each subsequent controller that you click. First, he goes to the second, and the second sends a link to the third, third premise of the link passed, which is the first.
Essentially, you are creating a temporary root controller. You can subclass the UINavigationController and add the temporaryRoot property and the popToTemporaryRootViewControllerAnimated: method, which will appear on your temporary root and clear it. When you press seconds for the first time, it also sets itself as a temporary root, so each controller on the stack should not pass the link around. You will need to add additional checks to prevent you from ever missing a temporary download without clearing it.
drawnonward Jun 12 2018-10-12T00: 00Z
source share