【发布时间】:2020-10-01 20:34:50
【问题描述】:
所以,我使用dequeueReusableCell 并将显示几个表视图,其中包含当前价格和更改价格的不同行号,具体取决于我选择的产品。
如何从标签更改 1、2、3 等获取文本字段的值?
由于是动态原型,所以不知道点击Change Price按钮时如何获取文本字段值。
我有这个类连接网点
class priceListCell: UITableViewCell {
// CURRENT PRICE
@IBOutlet weak var lblProductNameCurrentPrice: UILabel!
@IBOutlet weak var txtViewCurrentPrice: UITextView!
// EDIT PRICE
@IBOutlet weak var lblProductNameEditPrice: UILabel!
@IBOutlet weak var txtFieldEditPrice: UITextField!
@IBOutlet weak var btnChangePrice: UIButton!
}
而我的 TableView 代码是这样的:
....
case 1:
if let editPriceCell = tableView.dequeueReusableCell(withIdentifier: "editPriceCell", for: indexPath) as? priceListCell {
let product = editProducts[indexPath.row]
editPriceCell.lblProductNameEditPrice.text = product.productName
return editPriceCell
}
case 2:
if let changePriceCell = tableView.dequeueReusableCell(withIdentifier: "changePriceCell", for: indexPath) as? priceListCell {
return changePriceCell
}
这是我的功能,可以将价格更改为我遇到的火力基地:
func changeValue() {
for rowIndex in 0...self.tableView.numberOfRows(inSection: 3) {
let indexPath = NSIndexPath(item: rowIndex, section: 3)
}
}
我被卡住了,因为我不知道如何获得这样的动态单元格的值。 任何帮助将不胜感激。
谢谢你
【问题讨论】:
标签: ios swift firebase tableview swift5