Last active
September 30, 2022 11:03
-
-
Save OctoberHammer/1ee26471bd5060cfd1a6bf15adfadcf7 to your computer and use it in GitHub Desktop.
swift.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
class ViewControllerAdd: UIViewController { | |
var delegate : DataTableView? | |
@IBAction func exittoVC(_ sender: Any) { | |
delegate?.relodeTableView() | |
self.dismiss(animated: true, completion: nil) | |
} | |
} | |
class ViewControllerTable: UIViewController,UITableViewDelegate, UITableViewDataSource , DataTableView { | |
@IBOutlet weak var menubar: UINavigationItem! | |
@IBOutlet weak var menuView: UIView! | |
@IBOutlet weak var tableViewFirst: UITableView! | |
@IBOutlet weak var menuconst: NSLayoutConstraint! | |
@IBOutlet weak var tableViewMenu: UITableView! | |
var menuSwowing = false | |
var indexmenu :Int = 0 | |
var ItemsSelling: [Selling] = [] | |
var ItemsOrder: [Order] = [] | |
var ItemsCoordination: [Coordination] = [] | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
} | |
override func viewWillAppear(_ animated: Bool) { | |
self.tableViewFirst.reloadData() | |
} | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
var countS : Int = 0 | |
if (tableView == tableViewFirst && indexmenu == 0){ | |
countS = ItemsSelling.count | |
}else if(tableView == tableViewFirst && indexmenu == 1){ | |
countS = ItemsOrder.count | |
}else if(tableView == tableViewFirst && indexmenu == 2){ | |
countS = ItemsCoordination.count | |
}else if (tableView == tableViewMenu){ | |
countS = 3 | |
} | |
return countS | |
} | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
if (tableView == tableViewFirst){ | |
return navigator(indexM : indexmenu,tableView: tableView) | |
}else if (tableView == tableViewMenu){ | |
guard let cellMenu = tableView.dequeueReusableCell(withIdentifier: "CellMenu") as? MenuCell else { | |
return UITableViewCell() | |
} | |
cellMenu.tabnameMenuCell.text = casestr(indextab: indexPath.row) | |
cellMenu.layer.borderWidth = 1.0 | |
cellMenu.layer.borderColor = UIColor.gray.cgColor | |
return cellMenu | |
} | |
return UITableViewCell() | |
} | |
func relodeTableView() { | |
print("1") | |
self.tableViewFirst.reloadData() | |
} | |
} | |
protocol DataTableView { | |
func relodeTableView() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment