// // ChangeMealCollectItem.swift // ADHTuanCan // // Created by 敖德亨 on 2023/10/27. // import UIKit class ChangeMealCollectItem: UICollectionViewCell { @IBOutlet weak var replaceBtn: UIButton! @IBOutlet weak var foodImg: UIImageView! @IBOutlet weak var nameLab: UILabel! var changeFoodBlock : ((_ model : MealFoodMsgModel)->Void)? var dataSource : MealFoodMsgModel? //固定套餐列表 let reMarkView = Bundle.main.loadNibNamed("AddRemarkView", owner: nil, options: nil)?.last as? AddRemarkView override func awakeFromNib() { super.awakeFromNib() } func configDataSouce(model : MealFoodMsgModel){ self.dataSource = model self.foodImg.sd_setImage(url: URL.init(string: model.link ?? "") ,placeHolderImage: UIImage.init(named: "placeHolderImage")) self.nameLab.text = "\(model.name ?? "")" if model.replacePoolId != nil{ self.replaceBtn.isHidden = false }else{ self.replaceBtn.isHidden = true } } @IBAction func changeAction(_ sender: UIButton) { if self.changeFoodBlock != nil{ self.changeFoodBlock!(self.dataSource!) } } @IBAction func reMarkAction(_ sender: UIButton) { self.reMarkView?.showWithString(model: self.dataSource) } }