gpt4 book ai didi

iphone - 模型更改时更新 UI

转载 作者:行者123 更新时间:2023-12-03 17:18:01 26 4
gpt4 key购买 nike

我有一系列 UITableViewCell 元素和各种 UIControls 来设置模型值。

当我对模型进行更改时,我很难找到更新显示模型计算属性的 UITableViewCell 的方法。

我已将模型放置在 AppDelegate 中,并直接从 RootViewController 访问它。在每个 UITableViewCell 实现中,我都有一个在发生更改时更新模型的方法。

但是,我不知道如何刷新显示以显示更新。 (我尝试将同一个元素连接到两个操作。但是,操作完成的顺序不一致,因此它首先重新加载显示,然后更新模型)。

任何帮助将不胜感激。

谢谢..

最佳答案

I tried connecting the same element to two actions. But, the order in which the actions are completed is not consistent, so it first reloads the display, then updates the model

尝试仅使用一个操作,首先更新模型,完成后更新显示。在我看来,您的问题是同步这两个函数,因此我建议在模型更新函数之后考虑调用显示更新函数。

关于iphone - 模型更改时更新 UI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1732575/

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