I have UINavigationController and several UIViewControllers pushed into it. What I’d like to implement is to pop let’s say 2 view controllers back. However I’d like the previous controller in the stack be shown with animation before getting to the desired one (going thru it). This is the main reason why popToViewController: does not work for me.
Another thing I tried to call popViewControllerAnimated: with setting a flag to all previous UIViewControllers so that if flag is set, the view controller will invoke popViewControllerAnimated: in its viewDidAppear:. This gives me almost what I want, however I don’t like the animation is not smooth. Animation slows down for each controller, while I want all of them passed at the same speed.
One more approach I’m thinking is to avoid these controllers and put everything into one scroll view, which would give me total control of how to make view transactions.
Still I wonder if there’s something I can do with navigation controller?
Thank you for help.
I doubt You will achieve smooth animation (maybe if you implement different function, rather than
viewDidAppear:– then you can probably achieve it – for example – you have 3viewControllersin stack – you pop third, and in the same time initiate pop for second, with a delay which is as long as pop animation (0.25? dunno, test it). (you access second one from third via[self.navigationController viewControllers]) Maybe that works).I dont really like the idea about all
viewControllers(views) in a scrollview. – It could be too much memory consuming. Could.Other option would be – store a screenshot from each viewController. If only smooth poping animation is required, then you can take a screenshot from each
viewController(on background thread whileviewControlleris opened.) and add it to global scrollview imageSet. Then when popping – shortly show that scrollview, and animate through images, while under scrollview,viewControllershave already been popped to necessaryviewController.(If some
viewControllercontent is changed dynamically – it may not be important, as user won’t notice that from already taken screenshot which slides fast)Hope you got some new ideas 🙂