DestinationViewController Segue and UINavigationController swift

后端 未结 1 855
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 18:35

So I have a prepareForSegue method like this:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == \"from         


        
相关标签:
1条回答
  • 2020-12-02 19:23

    You only need to access the navigation controller's topViewController, which will be the AddEventViewController. Here is the code:

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if segue.identifier == "fromEventTableToAddEvent" {
    
            let nav = segue.destinationViewController as! UINavigationController
            let addEventViewController = nav.topViewController as! AddEventViewController
    
            addEventViewController.newTagArray = newTagArray
    
        }
    }
    
    0 讨论(0)
提交回复
热议问题