// // ViewController.swift // iOSTableViewWithImages // // Created by Michael Wilhelm on 6/05/2016. // Copyright © 2016 Michael Wilhelm. All rights reserved. // import UIKit class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { let staedte = ["NewYork", "Mailand", "Rom", "Wernigerode","Moskau", "Magdeburg", "München", "Kiel", "Amsterdam", "London", "Paris", "Tokio", "Toronto"] @IBOutlet var tableview: UITableView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. tableview.delegate=self tableview.dataSource=self } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func numberOfSectionsInTableView(tableView: UITableView) -> Int { return 1 } func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return staedte.count } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell:UITableViewCell=UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "mycell") cell.textLabel!.text = staedte[indexPath.row] cell.detailTextLabel!.text="hier stehen Details" let pictname = "Bild"+String(indexPath.row%5) let image : UIImage = UIImage(named: pictname)! cell.imageView!.image = image return cell } }