// // IHPickFloorCell.swift // Inhealth // // Created by weclouds on 2020/3/18. // Copyright © 2020 weclouds. All rights reserved. // import UIKit class IHPickFloorCell: UITableViewCell { var currentIndexPath:IndexPath? var completion:((DropDownData)->Void)? var buildList:[DropDownData]?{didSet{ self.floorView.removeSubviews() self.floorView.addSubview(self.buttonView) self.buttonView.frame = self.floorView.bounds self.buttonView.reloadData() }} lazy var buttonView: IHButtonView = { let buttonView = IHButtonView() buttonView.delegate = self return buttonView }() @IBOutlet weak var buildLabel: UILabel! @IBOutlet weak var floorView: UIView! override func awakeFromNib() { super.awakeFromNib() } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) } } extension IHPickFloorCell:IHButtonViewDelegate{ func numberofItem(in buttonView: IHButtonView) -> Int { return self.buildList?.count ?? 0 } func buttonView(_ buttonView: IHButtonView, titleFor item: Int) -> String { return (self.buildList![item].name)! } func buttonView(_ buttonView: IHButtonView, didSelected item: Int) { log.debug(self.buildList![item].name) let build = self.buildList![item] if build.name == "所有" { if self.buildList!.count > 1 { if let block = completion { block(self.buildList![1]) } } } if let block = completion { block(self.buildList![item]) } } }