7
// // ViewController.swift // Table Views // // Created by ZC on 16/1/9. // Copyright © 2016年 ZC. All rights reserved. // import UIKit class ViewController: UIViewController, UITableViewDelegate { var viewContent = ["apple","banana","pear","peach","watermelon"] override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return viewContent.count } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell") cell.textLabel?.text = viewContent[indexPath.row] return cell } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }