1

I have two UIViewControllers called VCA & VC B. VCB has two child views that are presented as modal View Controllers. The two modal View Controllers are M 1 And M 2. Is it possible to Go from M2 to VCA? I need to pop off M2 and go to VCA if possible. Pushing to VCA does not work because M2 does not have a navigation bar. And presenting VCA as a modal is not good because VCA needs to maintain its navigation bar.

So is it possible to jump from M2 which is a Modal ViewController to VCA.

Thanks in advance.

enter image description here

DevC
  • 6,982
  • 9
  • 45
  • 80
  • 1
    Hope this link will help. http://stackoverflow.com/questions/14907518/modal-view-controllers-how-to-display-and-dismiss – user2071152 Apr 18 '14 at 12:47

3 Answers3

1

VCA has a link that says it's your root controller, which means it should be the base of your navigation stack. So, instead of the branching diagram, you should have VCA -> VCB -> M1 -> M2 at run time. I would look at having VCB listen for a notification that M2 is finished. Then it can dismiss M1, which dismisses M2, and pop to the root view controller.

Phillip Mills
  • 30,888
  • 4
  • 42
  • 57
0

Use the custom delegate for the M2 UIViewController, just dismiss the modal View with respect to the delegate. and use the delegate method in the VC A controller to navigate to the VC B.

Community
  • 1
  • 1
Kumar KL
  • 15,315
  • 9
  • 38
  • 60
0

In Custom Function, we need to push navigationController object instead of particular object of viewController.Use the following code in Swift 2

    let objNextVC : SignUpOptionVC = self.storyboard?.instantiateViewControllerWithIdentifier("SignUpOptionVC") as! SignUpOptionVC
    let navigation = UINavigationController(rootViewController: objNextVC)
    navigation.navigationBarHidden = true
    self.navigationController?.presentViewController(navigation, animated: true, completion: nil)
Maninderjit Singh
  • 1,419
  • 1
  • 13
  • 23