【发布时间】:2018-05-18 17:21:22
【问题描述】:
我有一个包含 tableview 的容器视图控制器。在父视图控制器中,我使用下面的代码访问容器视图以设置一些变量并发送通知以重新加载表视图。但是当容器视图收到来自父级的通知时,它会将所有变量设置为默认值,并且不会将任何内容加载到表中:
在父视图控制器中:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let containerVC= storyboard.instantiateViewController(withIdentifier:"detailContainerVC") as! ContainerViewController
// self.navigationController?.pushViewController(containerVC,
// animated: false)
containerVC.section1RowCount = self.basicDataCount
containerVC.section2RowCount = self.checkDataCount
containerVC.GroupDetail = self.GroupDetail
containerVC.price = self.price
//containerVC.detailTable.reloadData()
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "fillDataDetail"), object: nil)
那么如何在父视图控制器中设置这个容器视图变量呢?
【问题讨论】:
标签: ios swift xcode uicontainerview