// // AddresViewCell.swift // ADHTuanCan // // Created by 敖德亨 on 2023/10/31. // import UIKit import SwiftyUserDefaults class AddresViewCell: UITableViewCell { @IBOutlet weak var haadImgView: UIImageView! @IBOutlet weak var nameLab: UILabel! @IBOutlet weak var phoneLab: UILabel! @IBOutlet weak var isDefualTypeLab: UILabel! @IBOutlet weak var postNumLab: UILabel! @IBOutlet weak var addressLab: UILabel! @IBOutlet weak var isDefualBtn: UIButton! var setDefualBlock : (()->Void)? var deleteBlock : (()->Void)? var addressModel : AddressModel? 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 } @IBAction func setDefualAction(_ sender: UIButton) { if self.setDefualBlock != nil{ self.setDefualBlock!() } } @IBAction func deleteAction(_ sender: UIButton) { if self.deleteBlock != nil{ self.deleteBlock!() } } func configModel(model : AddressModel){ self.addressModel = model self.haadImgView.sd_setImage(url: URL.init(string: "\(Defaults[\.Avatar] ?? "")") ,placeHolderImage: UIImage.init(named: "placeHolderImage")) self.nameLab.text = "\(model.receiving ?? "")" self.phoneLab.text = "\(model.phoneNum ?? "")" if model.isDefault == "1"{ self.isDefualTypeLab.isHidden = false self.isDefualBtn.isSelected = true }else{ self.isDefualTypeLab.isHidden = true self.isDefualBtn.isSelected = false } self.addressLab.text = "\(model.detailAddress ?? "")" self.postNumLab.text = "\(model.postcode ?? "")" } }