zoukankan      html  css  js  c++  java
  • 使用TableView

    关键代码如下:

     1 import UIKit
     2 
     3 class MyTV: UITableView ,UITableViewDataSource{
     4 
     5     let table_cell=1
     6     
     7     var array=["尽子轨","渣渣将","swift"]
     8     
     9     init(coder aDecoder:NSCoder!){
    10         super.init(coder:aDecoder)
    11         self.dataSource=self
    12     }
    13     init(frame: CGRect) {
    14         super.init(frame: frame)
    15         // Initialization code
    16     }
    17     func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
    18         return 1
    19     }
    20     
    21     func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
    22         var cell : AnyObject!=tableView.dequeueReusableCellWithIdentifier("cell")
    23         var label=cell.viewWithTag(table_cell) as UILabel
    24         label.text=array[indexPath.row]
    25         return cell as UITableViewCell
    26     }
    27     
    28     func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
    29         return 3
    30     }
    31     
  • 相关阅读:
    pythoon 学习资源
    cookie -- 添加删除
    前端技能
    jsonp 跨域2
    jsonp 跨域1
    webpy.org
    Flask 学习资源
    pip install flask 安装失败
    弹窗组价
    js中的deom ready执行的问题
  • 原文地址:https://www.cnblogs.com/newworldcom/p/4458329.html
Copyright © 2011-2022 走看看