// // MyOrderListTableViewCell.swift // xingchuangke // // Created by Apple on 2020/10/21. // Copyright © 2020 Virgil. All rights reserved. // import UIKit class MyOrderListTableViewCell: UITableViewCell { @IBOutlet weak var btn1: UIButton! @IBOutlet weak var btn2: UIButton! @IBOutlet weak var btn3: UIButton! @IBOutlet weak var totalLabel: UILabel! @IBOutlet weak var stateLabel: UILabel! @IBOutlet weak var nameText: UITextView! override func awakeFromNib() { super.awakeFromNib() // Initialization code } func initCell(rowIndex: Int, dic: NSDictionary) { totalLabel.text = "合计:\(getDoubleValue(dic: dic, key: "total"))元" if dic.getInt(key: "status") == 0 { stateLabel.text = "未支付" } else if dic.getInt(key: "status") == 1 { stateLabel.text = "待发货" } else if dic.getInt(key: "status") == 2 { stateLabel.text = "已发货" } else if dic.getInt(key: "status") == 3 { stateLabel.text = "已收货" } btn1.isHidden = true btn2.isHidden = true btn3.isHidden = true let array = dic["productOrderlist"]as!NSArray for i in 0..= 3 { } else { let dict = array[i]as!NSDictionary let imageBtn = UIButton.init() imageBtn.frame = CGRect(x: 10+90*i, y: 10, width: 80, height: 80) imageBtn.tag = 100+i imageBtn.setTitle("\(i)", for: .normal) imageBtn.titleLabel?.isHidden = true imageBtn.sd_setImage(with: NSURL.init(string: dict["image"]as!String) as URL?, for: .normal) self.addSubview(imageBtn) if i==0 { nameText.isHidden = false nameText.text = dict.getString(key: "name") btn1 = imageBtn btn1.isHidden = false }else if i==1{ btn1.isHidden = false nameText.isHidden = true btn2 = imageBtn }else if i==2{ nameText.isHidden = true btn3 = imageBtn btn1.isHidden = false } } } } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } }