Reputation: 915
I need to pop 3 controllers at once so I use PopToViewController
method from Navigation controller and then I push a new one into it. It results in a views overlapping.
Both controllers, to what it had been popped and what is being pushed are DialogViewControllers
. Besides this happens only on iPod/iPhone, on iPad it works correctly.
The code is just simple as:
NavigationController.PopToViewController(NavigationController.ViewControllers[NavigationController.ViewControllers.Count() - 1 - numberOfViews], animated);
NavigationController.PushViewController(viewController);
Any help?
Upvotes: 1
Views: 400
Reputation: 915
The problem was solved by setting animated parameter to false for iPhone.
NavigationController.PopToViewController(NavigationController.ViewControllers[NavigationController.ViewControllers.Count() - 1 - numberOfViews], false);
Upvotes: 0
Reputation: 1418
Instead of poping and pushing at the same time you should probably just replace the stack
UIViewControllers[] newStack = new UIViewController[NavigationController.ViewControllers.Count()-numberOfViews+1];
for (int i = 0; i < NavigationController.ViewControllers.Count()-numberOfViews; i++)
{
newStack[i] = NavigationController.ViewControllers[i];
}
newStack[NavigationController.ViewControllers.Count()-numberOfViews] = viewController;
NavigationController.SetViewControllers(newStack, true);
Upvotes: 1