【发布时间】:2015-11-10 13:37:23
【问题描述】:
我有一些将两个 ViewController 推送到 NavigationController 堆栈的代码。这是因为我想打开菜单的“子菜单”视图。
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)
正如您在代码中看到的,其中涉及一些委托。 menuSubVC 中的一种方法调用 menuVC 中的委托方法,当我尝试将 ImageView 出口设置为新的空图像时,这给了我一个错误:
allCheckmark.image = UIImage()
为什么这不起作用?当我打开菜单然后打开子菜单时,它工作得很好,但是如果我用上面的代码将两者都推送到堆栈中,它就不起作用了。
【问题讨论】:
标签: ios swift delegates navigationcontroller