gpt4 book ai didi

ios - 自定义UITableviewCell没有outlet

转载 作者:行者123 更新时间:2023-11-30 12:32:52 24 4
gpt4 key购买 nike

我有一个 TableView ,我需要使用带有标签和文本字段的自定义单元格。我在 Storyboard中设计了单元格。我已将自定义单元格的类设置为 ItemRowCell,并为其指定了重用标识符 itemRowCell。我已将标签和文本字段连接到 ItemRowCell 中的相应导出。

这是我的 ItemRowCell 类的代码

class ItemRowCell: UITableViewCell {
@IBOutlet weak var itemDescription: UILabel!
@IBOutlet weak var quantity: UITextField!

override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)

// Configure the view for the selected state
}

}

在我的数据源中我有这段代码

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "itemRowCell", for: indexPath) as! ItemRowCell
let (description, quantity) = self.currentItems[indexPath.row]

cell.itemDescription.text = description
cell.quantity.text = String(quantity)

return cell
}

不幸的是,单元中的两个导出都为零。

最佳答案

断开并重新连接 socket 解决了该问题。

关于ios - 自定义UITableviewCell没有outlet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43266798/

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