12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- //
- // IHCallView.swift
- // Inhealth
- //
- // Created by weclouds on 2019/12/13.
- // Copyright © 2019 weclouds. All rights reserved.
- //
- import UIKit
- class IHCallView: UIView {
- var didSelectedCallout:(()->Void)?
-
- var hotelData:HotelMapData?{
- didSet{
- if let data = self.hotelData{
- if let location = data.location ,let avatar = data.avatar,let purifiers = data.airPurCount,let sensors = data.sensorCount,let lights = data.lightCount,let cirLights = data.cicLightCount,let hotelname = data.name{
- self.address = location
- self.imageName = avatar
- self.purifiersCount.text = purifiers
- self.sensorsCount.text = sensors
- self.lightsCount.text = lights
- self.cirLightsCount.text = cirLights
- self.hotelName = hotelname
- }
-
- }
- }
- }
- var imageName :String?{
- didSet{
- if let imageName = self.imageName {
- hotelIcon.netImage(url: imageName, placeholder: "酒店头像")
- }
- }
- }
- deinit {
- log.debug("IHCallView销毁")
- }
- var hotelName :String?{
- didSet{
- hotelNameLabel.text = self.hotelName
- }
- }
-
- var address :String?{
- didSet{
- addressLabel.text = self.address
- }
- }
-
- @IBOutlet private weak var touchView: UIView!
-
- var closeCallback:(()->Void)?
-
- @IBOutlet private weak var purifiersCount:UILabel!
-
- @IBOutlet private weak var sensorsCount:UILabel!
- @IBOutlet private weak var lightsCount:UILabel!
- @IBOutlet private weak var cirLightsCount:UILabel!
-
- @IBOutlet private weak var hotelIcon: UIImageView!
-
- @IBOutlet private weak var hotelNameLabel: UILabel!
-
- @IBOutlet private weak var addressLabel: UILabel!
-
-
-
- override func awakeFromNib() {
- super.awakeFromNib()
- touchView.isUserInteractionEnabled = true
- let tap = UITapGestureRecognizer(target: self, action: #selector(tapViewAction))
- touchView.addGestureRecognizer(tap)
- }
-
- @objc func tapViewAction() {
- log.debug("tapViewAction")
- didSelectedCallout!()
- }
-
- @IBAction private func closeAction(_ sender: Any) {
- if let callback = self.closeCallback {
- callback()
- }
- }
- }
|