我有我的 UIViewController
,这是一个人的个人资料页面,它显示他们的姓名和照片。其中UIViewController
我有一个 UIContainerView
显示静态 UITableView
.加载配置文件页面时,我在更新表格的单元格时遇到了一些问题。这是我的 Storyboard:
我在我的 UIViewController
中尝试了以下方法.
我为我的 UIView
创建了一个导出。并将 person 对象传递给它。
在我的 UIView
我调用 segue 将对象传递给 UITableViewController
从那里我要更新一些标签。
func prepareForSegue(segue: UIStoryboardSegue!, sender: Any?){
if segue.identifier == "containerSegue"{
let statsTable = segue.destination as! CollectionTableViewController
statsTable.currentPerson = currentPerson
}
}
我的 Segue 从来没有被调用过。我已将其移至主
UIViewController
万一它应该从那里被调用,但又不被调用。这种方法我做错了什么?
最佳答案
假设您已将 Segue Identifier 设置为“containerSegue”,您应该在“Stats” View Controller 中获取它。
你在使用 Swift 3 吗?您可能只是 func 定义错误:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "containerSegue" {
let statsTable = segue.destination as! CollectionTableViewController
statsTable.currentPerson = currentPerson
}
}
那应该行得通。
关于ios - 在 containerview 中更新 TableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43414625/