gpt4 book ai didi

ios - swift - 无需重新加载自定义 UITableViewCell 即可设置 UILabel

转载 作者:搜寻专家 更新时间:2023-11-01 06:06:11 24 4
gpt4 key购买 nike

是否可以在不重新加载单元格的情况下为自定义 UITableViewCell 中的 UILabel 设置值?

我已经尝试了很多排列:

let indexPath = NSIndexPath(forRow: 0, inSection: 0)
let cell = tableView.cellForRowAtIndexPath(indexPath) as! CustomTableViewCell1
cell.customLabel.text = "text goes here"

.. 我不明白为什么这行不通。我在 UITableViewCell 中有一个 UITextField,当我设置 textField 值时,我只想更新标签,而不是重新加载整个单元格。有什么建议吗?

最佳答案

 cell.customLabel.setNeedsDisplay() 

关于ios - swift - 无需重新加载自定义 UITableViewCell 即可设置 UILabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36885259/

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