문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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.

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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top