// // SBTParamSet_BatteryCell.swift // SolarBT // // Created by weclouds on 2019/3/14. // Copyright © 2019 weclouds. All rights reserved. // import UIKit class SBTParamSet_BatteryCell: UITableViewCell { var autoRecognition :Bool? { didSet{ self.autoImageV.isHidden = !self.autoRecognition! } } var voltageStr : String?{ didSet{ voltageValue.text = self.voltageStr } } var batteryTypeStr :String?{ didSet{ log.debug(" c=============》\(self.batteryTypeStr)") batteryType.text = self.batteryTypeStr } } var itemdidSelectCallback:((Int)->Void)? @IBOutlet weak var batteryTypeView: UIView! @IBOutlet weak var voltageView: UIView! @IBOutlet weak var voltageValue: UILabel! @IBOutlet weak var autoImageV: UIImageView! @IBOutlet weak var batteryType: UILabel! @IBOutlet weak var systemVoltageLabel: UILabel! @IBOutlet weak var batterytypeLabel: UILabel! override func awakeFromNib() { super.awakeFromNib() batterytypeLabel.text = "Battery_type".da_localizedStr() systemVoltageLabel.text = "System_voltage".da_localizedStr() // Initialization code let tap = UITapGestureRecognizer(target: self, action: #selector(SBTParamSet_BatteryCell.tapAction)) voltageView.tag = 999990 voltageView.addGestureRecognizer(tap) let tap1 = UITapGestureRecognizer(target: self, action: #selector(SBTParamSet_BatteryCell.tapAction)) batteryTypeView.tag = 999991 batteryTypeView.addGestureRecognizer(tap1) } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { return super.hitTest(point, with: event) } @objc func tapAction(_ tap :UITapGestureRecognizer) { let index = tap.view!.tag - 999990 log.debug("选中了 ------ \(index )") itemdidSelectCallback!(index) } }