-2
我有一切正确的协议委托等设置。我唯一的问题是,我不能将CCC的委托设置为AAA。此代码在AAA.swift中:如何将模态子视图控制器的代表设置为父级?
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "AAAtoBBBSegue"{
let destination = segue.destination as! UINavigationController
let nextViewController = destination.viewControllers[0] as! CCC
nextViewController.delegate = self
}
}
将CCC委派设置为AAA是我唯一的问题!这非常令人沮丧,因为我必须先设置它的委托,然后才能将任何数据从CCC传递到AAA。 http://i.imgur.com/AlOwue9.png
那么,你为什么不能设置委托? –
在您的屏幕截图中,CCC是* not * destination.viewControllers [0] ..您需要将代理设置为BBB并将其“传递给CCC – DonMag
我刚拍了一张照片。我认为它们之间并不适用,因为它们之间有BBB。 –