123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- //
- // IHFloorPicker.swift
- // Inhealth
- //
- // Created by weclouds on 2020/3/13.
- // Copyright © 2020 weclouds. All rights reserved.
- //
- import UIKit
- import IBAnimatable
- class IHFloorPicker: AnimatableModalViewController {
- var completion:((DropDownData)->Void)?
- var build:DropDownData?
- @IBOutlet weak var hotelNameLabel: UILabel!
-
- @IBOutlet weak var contentView: UIView!
- var buttonArr :[UIButton]? = [UIButton]()
- var buildList:[DropDownData]?{
- didSet{
- self.contentView.removeSubviews()
- self.contentView.addSubview(self.buttonView)
- self.buttonView.frame = self.contentView.bounds
-
- self.buttonView.reloadData()
- }
- }
-
- lazy var buttonView: IHButtonView = {
- let buttonView = IHButtonView()
- buttonView.delegate = self
- return buttonView
- }()
- var hotelName : String?{
- didSet{
- self.hotelNameLabel.text = self.hotelName
- }
- }
- override func viewDidLoad() {
- super.viewDidLoad()
- }
- @IBAction func close(_ sender: Any) {
- self.dismiss(animated: true, completion: nil)
- }
-
- @IBAction func save(_ sender: Any) {
- if let block = self.completion {
- block(self.build ?? self.buildList![0])
- }
- self.dismiss(animated: true, completion: nil)
- }
-
-
- }
- extension IHFloorPicker: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!)
- self.build = self.buildList![item]
- }
-
-
- }
|