Blame view

App/createNew/VCConfirmMucDaChon.swift 2.19 KB
d774f0637   Trịnh Văn Quân   fisrt comit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
  import UIKit
  
  class VCConfirmMucDaChon: UIViewController, IVCLoadDataTableViewUIThread {
      @IBOutlet weak var topMargin: NSLayoutConstraint!
      @IBOutlet weak var tableView: UITableViewLoadDataFromUIThread!
  
      static func getInstance() -> VCConfirmMucDaChon {
          let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
          let vcOpen = storyboard.instantiateViewController(withIdentifier: "VCConfirmMucDaChon") as! VCConfirmMucDaChon
          return vcOpen
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
          tableView.emptyText = "Empty"
          CellMucChupWithCamera.registerClass(tableView: tableView, forCellReuseIdentifier: "CellMucChupWithCamera")
          self.tableView.separatorStyle = UITableViewCellSeparatorStyle.singleLine
          self.tableView.allowsSelection = false
          self.tableView.rowHeight = UITableViewAutomaticDimension
          self.tableView.estimatedRowHeight = 150
      }
  
      override func viewWillAppear(_ animated: Bool) {
          super.viewWillAppear(animated)
          tableView.initAndLoadData(self)
      }
  
      @IBAction func btnRightClick(_ sender: Any) {
          _ = getVcRoot()?.changeCurrentController(VCSettingBienQC.getInstance())
      }
  
      @IBAction func btnLeftClick(_ sender: Any) {
          _ = getVcRoot()?.changeCurrentController(VCChonMucChup.getInstance())
      }
  
      //region ============== TableView Data =========
  
      func loadDataOnUI(complete: @escaping ([Any]?) -> ()) {
          if let list = getVcRoot()?.mucChups {
              var mucChups = [MucChup]()
              for item in list {
                  if item.isSelected == true { mucChups.append(item) }
              }
              complete(mucChups)
          } else {
              complete(nil)
          }
      }
  
      func getAllCell() -> [BaseCell] {
          var baseCells: [BaseCell] = [BaseCell]();
          baseCells.append(BaseCell(type: 0, identifier: "CellMucChupWithCamera"))
          return baseCells
      }
  
      func getTypeOfData(baseobj: Any) -> Int {
          return 0
      }
  
      func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
      }
  
      //endregion
  
      func getVcRoot() -> VCRootCreateNew? {
          return self.parent as? VCRootCreateNew
      }
  }