Closed Quailcreek closed 5 years ago
You have to push a view controller, not another navigation controller. If you really want to display another navigation controller, you need to present it, not push it. If you push the controller (FigureListVC), it will be added in the navigation controller stack.
revealViewController() is not a navigation controller (it is a container view controller) and pushMainViewController add a child view controller which in your cas is a navigation controller. After that, your navigation controller have to push an other controller, not a other navigation controller.
Hi,
Thank you for the education. I've only been on Xcode/Swift for a little over a month. I had it in my mind that if I imbedded the navigationController I had to navigate to the navigationController from then on. I didn't realize I could still just navigate to the to original viewController. I went back to my original code and it works fine.
let homeView = self.storyboard?.instantiateViewController(withIdentifier: "FigureList_VC") as! FigureList_VC self.navigationController?.pushViewController(homeView, animated: true)
Hi, I'm having some trouble and I could use a point in the right direction. I looked over all of the closed issues but I didn't see anything that I could use to make this work or if there was I didn't recognize it.
I had everything working just fine. Then I decided I wanted to have better control of the navBar on each VC so I embedded them in a navigationController. What I'm trying to do is navigate from the button to the navigationController as I have indicated with the green arrow.
This was the code that was working before I embedded the navigation controllers. The func is called from an alert action sheet generated from the button.
func figList() { let homeView = self.storyboard?.instantiateViewController(withIdentifier: "FigureList_VC") as! FigureList_VC self.navigationController?.pushViewController(homeView, animated: true) }
This code now throws the error that it cannot push a navigationController. I got it to work from the PBRevealViewController menu on the welcome VC with the code below. The thing is that I won't have the menu button active on the welcome VC on the final app version. I just made it active so I could trouble-shoot the problem.
if controllers[indexPath.row] == "FigureList_NavController" { if FigureList_NC == nil { FigureList_NC = storyboard.instantiateViewController(withIdentifier: controllers[indexPath.row]) as? UINavigationController } revealViewController()?.pushMainViewController(FigureList_NC!, animated:true) FigureList_NC = nil }
It doesn't throw any errors but it doesn't go to the navigationController either, it just sits there looking a me.
What am I doing wrong?