Skip to content

Instantly share code, notes, and snippets.

@OctoberHammer
Created October 12, 2017 08:43
Show Gist options
  • Save OctoberHammer/69a5a07e474e306f4f02e94b01a4d506 to your computer and use it in GitHub Desktop.
Save OctoberHammer/69a5a07e474e306f4f02e94b01a4d506 to your computer and use it in GitHub Desktop.
sw.swift
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