zoukankan      html  css  js  c++  java
  • 7_Table Views

    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.
        }
    
    
    }
    

    项目:7_Table Views

  • 相关阅读:
    状态模式
    适配器模式
    观察者模式
    浮点数在内存中的存储方式
    建造者模式
    外观模式
    模版方法模式
    原型模式
    Python 学习笔记6 变量-元组
    Python 学习笔记5 变量-列表
  • 原文地址:https://www.cnblogs.com/zcdll/p/5161042.html
Copyright © 2011-2022 走看看