gpt4 book ai didi

ios - 在 containerview 中更新 TableView

转载 作者:行者123 更新时间:2023-12-01 19:54:43 25 4
gpt4 key购买 nike

我有我的 UIViewController ,这是一个人的个人资料页面,它显示他们的姓名和照片。其中UIViewController我有一个 UIContainerView显示静态 UITableView .加载配置文件页面时,我在更新表格的单元格时遇到了一些问题。这是我的 Storyboard:

enter image description here

我在我的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com