0

I have some code that push two ViewControllers to the NavigationController stack. This is because i want to open a "submenu" view of my menu.

let menuVC = storyboard!.instantiateViewControllerWithIdentifier("menuView") as! MenuTableViewController
            menuVC.delegate = self

let menuSubVC = storyboard!.instantiateViewControllerWithIdentifier("menuViewSub") as! SubscriptionsTableViewController
            menuSubVC.delegate = menuVC

            controllers?.append(menuVC)
            controllers?.append(menuSubVC)

navigationController?.setViewControllers(controllers!, animated: true)

As you can see in the code there are some delegates involved in this. One method in menuSubVC calls a delegate method in menuVC that give's me an error when i try to set an ImageView outlet to a new empty image:

allCheckmark.image = UIImage()

Why is this not working? It's working perfect when i open menu and then the submeny, but if i push both to the stack with my code above it's not working.

Lord Vermillion
  • 5,264
  • 20
  • 69
  • 109

1 Answers1

0

When you push both onto the stack, the subMenuVC is underneath, so the view is not loaded, which means none of the IBOutlets are set.

Abizern
  • 146,289
  • 39
  • 203
  • 257