Search code examples
iosobjective-cdismisspresentviewcontroller

iOS App navigation


My Application flow is as below where A, B , c and D are view controllers. Arrows mark presenting from and to view controllers.

enter image description here

Now I need home button in B , C and D view controller that navigate back to A. I am not using storyboard. Its I am unable to use dismissviewcontroller as it dismisses just once, where in some cases its required 2 or 3 previous view controllers dismiss.

Any suggestions in this regards will be helpful.


Solution

  • It sounds like you should be using A as your root view controller on a UINavigationController. The only thing B, C, and D will need to do is call popToRootViewController.

    You'll need to make your login view controller be pushed from A, but you can do it without the user seeing it by putting the code in the AppDelegate (which is likely where you're checking to see if the user needs to log in anyway).