import UIKit import GeneralUtils import Alamofire class VCShootItemList: UIViewController, IVCLoadDataTableViewUIThread { @IBOutlet weak var topMargin: NSLayoutConstraint! @IBOutlet weak var tableView: UITableViewLoadDataFromUIThread! @IBOutlet weak var imvLogo: UIImageView! @IBOutlet weak var tvTitle: UILabel! weak var tableViewListCtruong: UITableViewLoadDataFromUIThread? var cTruong: CongTruong! static func openController(_ viewController: UIViewController, cTruong: CongTruong, tableViewListCtruong: UITableViewLoadDataFromUIThread?) { let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let vcOpen = storyboard.instantiateViewController(withIdentifier: "VCShootItemList") as! VCShootItemList vcOpen.cTruong = cTruong vcOpen.tableViewListCtruong = tableViewListCtruong; viewController.present(vcOpen, animated: true, completion: nil) } override func viewDidLoad() { super.viewDidLoad() tableView.emptyText = LocalizedString("empty_muc_chup") CellMucChupWithCamera.registerClass(tableView: tableView, forCellReuseIdentifier: "CellMucChupWithCamera") self.tableView.separatorStyle = UITableViewCellSeparatorStyle.singleLine self.tableView.rowHeight = UITableViewAutomaticDimension self.tableView.estimatedRowHeight = 150 let tap = UITapGestureRecognizer.init(target: self, action: #selector(VCShootItemList.logoClick)) imvLogo.addGestureRecognizer(tap) tableView.initAndLoadData(self) tvTitle.text = cTruong.constructionName } @IBAction func btnEditClick(_ sender: Any) { VcEdit.openController(self, cTruong: self.cTruong, tableViewListCtruong: self.tableViewListCtruong, vcShootItemList: self) } //region ============== TableView Data ========= func loadDataOnUI(complete: @escaping ([Any]?) -> ()) { guard let shootItems = cTruong.shootItems else { complete(nil) return } var shootItemsWillShoot = [ShootItem]() for item in shootItems { if let willShoot = item.willShoot, willShoot > 0 { shootItemsWillShoot.append(item) } } complete(shootItemsWillShoot) } 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 override var prefersStatusBarHidden: Bool { return true } override open var supportedInterfaceOrientations: UIInterfaceOrientationMask { return UIInterfaceOrientationMask.portrait } func logoClick() { dismiss(animated: true) } }