I didn’t plan ahead properly for view navigation in my app, so it’s possible for the user to go through a loop that just stacks modal views on top of each other, and from there the root view controller is only accessible through the time-consuming process of manually dismissing each and every repeated view.
I can’t just go ahead and use popToRootViewControllerAnimated: without a navigation controller on top of it all (calling presetModalViewController:animated: repeatedly seemed like a good idea at the time), so unless there’s something Google is hiding from me, I’m completely lost.
Rewriting half the navigation code is not ideal, but if that really is the only option, I’ll give it a shot.
Avoiding that would certainly be preferable.
No idea what code would be helpful, if any. It’s just presenting/dismissing modal view controllers with a few subclasses of UIViewController
Okay, now I got it. Below the line is what I should never have done. Rather than trying to contain a loop-grown stack, I should have just blocked it to begin with.
That is, the “Load” button no longer spawns another view. Instead, it dismisses the current view, which can only ever be a child of the Load view, giving the illusion of a new view and completely removing the problem of an uncontrollably growing stack.
Again, this is the wrong option:
A global, a few
#define‘d strings, and some if/else stacks, and the lack of a navigation controller is not a problem.If anyone is interested in what I’ve done to achieve this (and/or how much fun it’ll be to modify later), I’ll drop some of the it into this answer. It’s not pretty and it was a pain to write (mostly because the new code spans four files and breaks quietly), but it does exactly what I want.