TableViewEditNewDel

TableView-Methoden

    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return staedte.count
    }
    
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "mycell", for: indexPath) as! MyCell
        let stadt:Stadt = staedte[ indexPath.row ]        
        cell.title!.text = stadt.name
        cell.subtitle!.text=stadt.bemerkung
        cell.nr!.text=String(stadt.nr)
        return cell        
    }
    
    func tableViewOld(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {        
        let cell:UITableViewCell=UITableViewCell(style:UITableViewCellStyle.subtitle, reuseIdentifier:"mycell")
        let stadt:Stadt = staedte[ indexPath.row ]
        cell.textLabel!.text = stadt.name
        cell.detailTextLabel!.text=stadt.bemerkung
        return cell
        
    }



Stadt UND Nr

staedte.append( Stadt(1,"New York", "Manhattan") )

staedte.append( Stadt(2,"Mailand", "Mailander Scala") )

staedte.append( Stadt(3,"Rom", "Vatikan, Michelangelo") )

staedte.append( Stadt(4,"Moskau", "Roter Platz") )

staedte.append( Stadt(5,"Wernigerode", "HS Harz") )

staedte.append( Stadt(6,"New York", "Manhattan") )

staedte.append( Stadt(7,"Paris", "Louvre") )

staedte.append( Stadt(8,"Los Angeles", "Hollywood") )

staedte.append( Stadt(9,"Kairo", "Pyramiden") )

staedte.append( Stadt(10,"Magdeburg", "Der schiefe Turm") )

staedte.append( Stadt(11,"San Francisco ", "Alcatraz") )

staedte.append( Stadt(12,"London ", "Tower für St?denten") )

staedte.append( Stadt(13,"Madrid ", "Almudena-Kathedrale") )

staedte.append( Stadt(14,"Barcelona", "Kathedrale von Barcelona") )

staedte.append( Stadt(15,"Dresden ", "Tal der Ahnungslosen") )

staedte.append( Stadt(16,"Peking ", "Verbotene Stadt") )

staedte.append( Stadt(17,"Venedig ", "Trocken!") )

staedte.append( Stadt(18,"Berlin ", "Schnellster Flughafenbau (jemals") )

staedte.append( Stadt(19,"Tokio ", "Hotel!") )

staedte.append( Stadt(20,"Denver ", "Clan") )

staedte.append( Stadt(21,"Halberstadt ", "Schnellster Straßenbau aller Zeiten") )


Stadt

staedte.append( Stadt("New York", "Manhattan") )
staedte.append( Stadt("Mailand", "Mailander Scala") )
staedte.append( Stadt("Rom", "Vatikan, Michelangelo") )
staedte.append( Stadt("Moskau", "Roter Platz") )
staedte.append( Stadt("Wernigerode", "HS Harz") )
staedte.append( Stadt("New York", "Manhattan") )


unwind-MainViewController

@IBAction func unwindToEditView(_ segue:UIStoryboardSegue) {

if let src = segue.source as? EditViewController {

if let indexPath = tableview.indexPathForSelectedRow {

}

}

}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

if let button:UIButton = sender as! UIButton {

if button==bnEdit {

if let indexPath = tableview.indexPathForSelectedRow {

}

}

}

}


unwind-EditViewController

@IBAction override func unwind(for unwindSegue: UIStoryboardSegue, towardsViewController subsequentVC: UIViewController) {

}