提问人:Edwin Rivas 提问时间:2/7/2020 更新时间:2/11/2020 访问量:51
当位于子视图时,我无法将touchUpInside of按钮调用到ViewController
I can't call touchUpInside of button to ViewController when is at a subview
问:
我正在用卡片钱包制作一个库,但是当我按下控制器中的按钮不起作用时,如果我的实例不好,我不会 kwon,需要帮助。
项目的存储库在github中,这是链接:https://github.com/RAES9/WalletOfCards
名称类 ID WalletOfCards.swift
let controller = self.delegate?.storyboard!.instantiateViewController(withIdentifier: self.destitaionController as String)
self.delegate?.addChild(controller!)
controller!.didMove(toParent: self.delegate!)
行:143,144,15。
功能:tappedButton
答:
0赞
Edwin Rivas
2/11/2020
#1
我为我的控制器创建了新的 var,并在其中添加了新的子视图
let controller = self.dataSource.storyboard!.instantiateViewController(withIdentifier:
self.destitaionController as String)
self.dataSource.addChild(controller)
controller.didMove(toParent: self.dataSource)
controller.view.frame = CGRect(x: 0, y: 0, width: (cardSelected?.frame.width)!, height: (cardSelected?.frame.height)!)
controller.view.alpha = 0.0
self.dataSource.view.addSubview(controller.view)
controller.view.alpha = 1.0
评论