0

i have login view controller. when usersingin i' showing popup for that i

refereed https://www.youtube.com/watch?v=S5i8n_bqblE i can achieved that. popup had button when i click the button navigation to next view controller but its now working when i am clicking that action is performing but its not navigating to next view controller wher i did mistake

Singin 

class DigitalGateViewController: NANavigationViewController
{

      @IBAction func singin(_ sender: UIButton)
        {
                    let lv = NAViewPresenter().activityVC()
                    self.present(lv, animated: true)
         }

}

 this is popupviewcontroller 

  class ActivityViewController: NANavigationViewController {



    @IBAction func okbuttonclick() {
           let dv = NAViewPresenter().myGuestListVC()
           // self.navigationController?.pushViewController(dv, animated: true)
            }
    }

its not push to textview controller in swift

2 Answers 2

1

When you present a view controller, its presented modally and is not pushed onto the previous navigation controller's stack. Hence, you tried to call self.navigationController?.pushViewController(), it doesn't work, because self i.e. NAViewPresenter().myGuestListVC() isn't embedded in a navigation Controller.

If you want to push the new VC onto the previous stack, you will have to dismiss the presented pop up and then push. The easiest way to do this is to use a delegate method.

Edit:

if you want to create a new navigationController, you can do something like this :

let navController = UINavigationController(rootViewController: NAViewPresenter().myGuestListVC())
present(navController, animated: true)

After presenting the navController, you can use self.navigationController.push method henceforth.

Sign up to request clarification or add additional context in comments.

1 Comment

navigation is there for previous view controller its now working for this one only how to over come this issue
0

The reason why its not pushing because you are presenting it modally not pushing on the navigation stack and so it wont have any navigationController. If you want to push from your modal popup, you can access the property presentingViewController on your modal object and try to push it on navigationController from there.

self.presentingViewController?.navigationController?.pushViewController(myVC, animated: true)
dismiss(animated: true, completion: nil)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.