首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >当我在表视图中单击复选框时,一个标签中的金额应该会添加到iOS中的另一个标签中

当我在表视图中单击复选框时,一个标签中的金额应该会添加到iOS中的另一个标签中
EN

Stack Overflow用户
提问于 2019-06-26 17:42:53
回答 1查看 42关注 0票数 0

我在一个表视图中有复选框和标签,当我们点击复选框时,在表视图的每个单元格中的标签中出现的价格应该添加到另一个视图中出现的另一个标签中

代码语言:javascript
运行
复制
@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()
        }
    }
}
EN

回答 1

Stack Overflow用户

发布于 2019-06-26 18:19:49

代码语言:javascript
运行
复制
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
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56769723

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档