gpt4 book ai didi

ios - 重新加载 View 时,Xcode Swift IOS Eureka LabelRow 不更新标题

转载 作者:行者123 更新时间:2023-11-30 11:14:22 25 4
gpt4 key购买 nike

返回到包含以下代码的 View 时,LabelRow $0.title 未更新。

如何让 LabelRow 在从更改全局变量的“推送” View 返回后更新其标题?

form +++

Section("Current Person")
<<< LabelRow {
$0.title = currentPersonName // "currentPersonName" is a global variable
$0.tag = "Person"
}.cellUpdate { cell, _ in
cell.row.title = currentPersonName // set title to "currentPersonName"
print("cellUpdate shows \(currentPersonName)") // verify "currentPersonName" change
}.onCellSelection { _, _ in
// the following view controller sets "currentPersonName" to something new
let PersonPicker = PersonPicker()
self.navigationController?.pushViewController(PersonPicker, animated: false)
print("onCellSelection shows \(currentPersonName)") // verify "currentPersonName" change
}

最佳答案

这是我所做的“修复”它:

override func viewDidAppear(_ animated: Bool)
{
if let row = self.form.rowBy(tag: "Person")
{
row.title = currentPersonName
row.reload()
}
}

但这是最好的解决方案吗?

关于ios - 重新加载 View 时,Xcode Swift IOS Eureka LabelRow 不更新标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51886226/

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