How to pass prepareForSegue: an object

后端 未结 10 2069
北荒
北荒 2020-11-21 11:18

I have many annotations in a mapview (with rightCalloutAccessory buttons). The button will perform a segue from this mapview to a tableview

10条回答
  •  不知归路
    2020-11-21 11:43

    For Swift use this,

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        var segueID = segue.identifier
    
        if(segueID! == "yourSegueName"){
    
            var yourVC:YourViewController = segue.destinationViewController as YourViewController
    
            yourVC.objectOnYourVC = setObjectValueHere!
    
        }
    }
    

提交回复
热议问题