我正在尝试将数据从 xib 向上传递两个级别到 VC,以便我可以导航到单独的视图。我确实在 IGListKit 部分中获取了数据,但由于某种原因,passDataFromSectionUp
函数不会触发print("like")
VC 中的函数。
风险投资
class MainViewController: UIViewController, PassSectionDelegate {
func passDataFromSectionUp(sectionController: ExperiencesSectionController) {
print("Like"); //Doesn't trigger
}
IGListKit 部分
protocol PassSectionDelegate: class {
func passDataFromSectionUp(sectionController: ExperiencesSectionController);
}
class ExperiencesSectionController: ListSectionController, UpdateDataDelegate {
weak var delegate: PassSectionDelegate? = nil;
func passUpdateData(data: String) {
print(data) //Data gets received
delegate?.passDataFromSectionUp(sectionController: self);
}
...
if let cell = cell as? CarouselControlCell {
cell.delegate = self;
}
西布
protocol UpdateDataDelegate: class {
func passUpdateData(data: String);
}
class CarouselControlCell: UICollectionViewCell {
weak var delegate: UpdateDataDelegate? = nil
@IBAction func addUpdate(_ sender: Any) {
delegate?.passUpdateData(data: "teeest");
}