Blame view
App/createNew/VCChonMucChup.swift
2.32 KB
d774f0637
|
1 |
import UIKit |
1341bf603
|
2 |
import GeneralUtils |
d774f0637
|
3 4 5 6 |
class VCChonMucChup: UIViewController, IVCLoadDataTableViewUIThread { @IBOutlet weak var topMargin: NSLayoutConstraint! @IBOutlet weak var tableView: UITableViewLoadDataFromUIThread! |
1341bf603
|
7 |
@IBOutlet weak var vTopLogo: VTopLogo! |
d774f0637
|
8 9 10 11 12 13 14 15 16 |
static func getInstance() -> VCChonMucChup { let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let vcOpen = storyboard.instantiateViewController(withIdentifier: "VCChonMucChup") as! VCChonMucChup return vcOpen } override func viewDidLoad() { super.viewDidLoad() |
1341bf603
|
17 18 19 |
vTopLogo.leftBtnClick = { self.btnLeftClick(self.vTopLogo) } |
d774f0637
|
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 |
tableView.emptyText = "Empty" CellChonMucChup.registerClass(tableView: tableView, forCellReuseIdentifier: "CellChonMucChup") self.tableView.separatorStyle = UITableViewCellSeparatorStyle.singleLine 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(VCConfirmMucDaChon.getInstance()) } @IBAction func btnLeftClick(_ sender: Any) { _ = getVcRoot()?.changeCurrentController(VCNhapMucChup.getInstance()) } //region ============== TableView Data ========= func loadDataOnUI(complete: @escaping ([Any]?) -> ()) { complete(getVcRoot()?.mucChups) } func getAllCell() -> [BaseCell] { var baseCells: [BaseCell] = [BaseCell](); baseCells.append(BaseCell(type: 0, identifier: "CellChonMucChup")) return baseCells } func getTypeOfData(baseobj: Any) -> Int { return 0 } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
1341bf603
|
57 |
if let mucChup = self.tableView.getItem(indexPath) as? ShootItem { |
defd9642e
|
58 59 |
if mucChup.willShoot == 1 { mucChup.willShoot = nil |
d774f0637
|
60 |
} else { |
defd9642e
|
61 |
mucChup.willShoot = 1 |
d774f0637
|
62 63 64 65 66 67 68 69 70 71 72 |
} self.tableView.reloadRows(at: [indexPath], with: .none) } } //endregion func getVcRoot() -> VCRootCreateNew? { return self.parent as? VCRootCreateNew } } |