我有一个由motherViewController 控制的motherView,里面有一个容器视图。容器视图由 childViewController 控制。childView 拥有一个 tableView。
现在我在 childViewController 中有一个 cleanTableView 函数,它在调用时会“重置”tableView。
func clean() {
let indexPath = IndexPath(row: 0, section: 0)
if let cell = tableView.cellForRow(at: indexPath) {
if cell.accessoryType == .checkmark {
cell.accessoryType = .none
}
}
}
在我的母亲视图中有一个按钮。当这个按钮被触摸时,它会调用 MotherViewController 上的一个动作。
@IBAction func cancelButtonTapped(_ sender: UIBarButtonItem) {
//call clean method of containerView instance
}
如何通过此操作调用特定 childView 实例上的 cleanTableView 函数?