prepareForSegue and PerformSegueWithIdentifier sender

后端 未结 6 912
执笔经年
执笔经年 2021-02-03 13:18

I am wondering about how the functions in the title work and also about the sender parameter.

Lets say a button click calls the performSegue method, does that also call

6条回答
  •  礼貌的吻别
    2021-02-03 13:57

    my two cents for beginners... In swift 3 is:

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    
    }
    

    So, if arriving controller (of class MyController) implements a "fillData" method:

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    
        if let destController = segue.destination as MyController{
    
            destController.fillData(...)
        }
    
    }
    

提交回复
热议问题