gpt4 book ai didi

ios - 当我单击表格 View 内的复选框时,一个标签内存在的数量应添加到 iOS 中的另一个标签

转载 作者:行者123 更新时间:2023-11-29 05:38:50 24 4
gpt4 key购买 nike

我在表格 View 中有复选框和标签,当我们单击复选框时,表格 View 每个单元格中标签中显示的价格应添加到另一个 View 中存在的另一个标签

@IBAction func checkUncheckButtonAction(_ sender: UIButton) {


if let cell = sender.superview?.superview as? PrepaidPageTableViewCell
{

let indexPath = tableviewOutlet.indexPath(for: cell)

if cell.checkUncheckButtonOutlet.isSelected == false
{

cell.checkUncheckButtonOutlet.setImage(#imageLiteral(resourceName: "checked_blue"), for: .normal)

cell.checkUncheckButtonOutlet.isSelected = true

viewHeightConstraint.constant = 65

cell.amountOutlet.text = "₹ "+amount_receivable_from_customerArray[indexPath!.row]

isPrepaidOrder = false

tableviewOutlet.reloadData()

} else {

cell.checkUncheckButtonOutlet.setImage(#imageLiteral(resourceName: "unchecked_blue"), for: .normal)

cell.checkUncheckButtonOutlet.isSelected = false

self.viewHeightConstraint.constant = 0

tableviewOutlet.reloadData()
}
}
}

最佳答案

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

let cell = tableView.dequeueReusableCell(withIdentifier: "PrepaidPageTableViewCell") as! PrepaidPageTableViewCell

cell.customerNameOutlet.text = buyer_nameArray[indexPath.row]
cell.deliverydateOutlet.text = "Delivery Date:\(dispatch_dateArray[indexPath.row])"
cell.amountOutlet.text = "₹\(amount_receivable_from_customerArray[indexPath.row])"

cell.dispatchidoutlet.text = "Dispatch ID: \(id_dispatch_summaryArray[indexPath.row])"
cell.dispatchdateOutlet.text = "Dispatch Date:\(dispatch_dateArray[indexPath.row])"
cell.checkUncheckButtonOutlet.setImage(#imageLiteral(resourceName: "unchecked_blue"), for: .normal)

cell.selectionStyle = .none

return cell
}

关于ios - 当我单击表格 View 内的复选框时,一个标签内存在的数量应添加到 iOS 中的另一个标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56769723/

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