// // StudentTableViewController.swift // SchoolList8 // // Created by Quentin Millardet on 14/10/2020. // import UIKit class LightshowDownloadView: UITableViewController{ var model:LightshowModel? override func viewDidLoad() { super.viewDidLoad() model = (UIApplication.shared.delegate as! AppDelegate).model } // Return the number of rows for the table. override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return model!.getStudentCount() } // Provide a cell object for each row. override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { // Fetch a cell of the appropriate type. let cell = tableView.dequeueReusableCell(withIdentifier: "lightshowDownloadCell") let model = model?.getStudentAtIndex(indexPath.row); (cell as! LightshowDownloadCell).LightshowName.text = model?.name (cell as! LightshowDownloadCell).warningMessage.isHidden = model?.isOkFiles() ?? false; return cell! } // Permet de passer des informations à une vue avant que celle-ci ne soit créee override func prepare(for segue: UIStoryboardSegue, sender: Any?) { } @IBAction func unwindFromCancel(_ unwindSegue: UIStoryboardSegue) { //let sourceViewController : EditController = unwindSegue.source as! EditController //NSLog(sourceViewController.nameField.text!) // Use data from the view controller which initiated the unwind segue } @IBAction func unwindFromOk(_ unwindSegue: UIStoryboardSegue) { //let sourceViewController : EditController = unwindSegue.source as! EditController let newName : String = "sourceViewController.nameField.text!" let row : Int = 1; model?.setStudentAtIndex(row , withdraw: newName) tableView.reloadData() } }