Swift : prepareForSegue with navigation controller

后端 未结 8 875
情书的邮戳
情书的邮戳 2020-12-12 17:46

I am developing an iOS application in Swift.

I want to send data from a view to an other one, using the prepareForSegue function.

However, my target view is

8条回答
  •  臣服心动
    2020-12-12 18:25

    Set the identifier name in the segue arrow property in order to use in the the performeSegue.

    Like this:

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    
        if let vc: ProfileViewController = segue.destination as? ProfileViewController {
    
            //do any setting to the next screen
    
        }
    
    }
    

    and then:

        performSegue(withIdentifier: "yourIdentifierOfViewProfile", sender: indexPath.row)
    

    I hope it helps.

提交回复
热议问题