I have three view controllers, say A, B and C. I am navigating through this views like follows;
A -presenting-> B -presenting-> C -presenting-> B
And from B, if I dismiss I want to navigate to C. But instead of that, now it is moving to A. I can’t use dismiss for navigation from C to B (some internal issues). So how can I fix this? Please help.
You hit into a limitation of
dismissModalViewController: it will remove all of your modal views (source):What you could do is using a
UINavigationControllerand simply push/pop controllers on to it according to your requirements.Alternatively, you could simply display the views managed by the various controllers you have by directly calling
addSubviewon your top view and making sure they cover the whole screen and that the managing controller is correctly retained/released (the view is automatically when you add/remove it to another view).As a hint, you could do it like this:
where you have
presentModal..., useaddSubview;where you have
dismiss..., useremoveFromSuperview;store a reference to any view controller whose view you manage like I suggest here in
retain/strongproperty.