首页 > 其他 > 详细

使用TableView

时间:2015-04-26 20:59:46      阅读:197      评论:0      收藏:0      [点我收藏+]

关键代码如下:

 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     

 

使用TableView

原文:http://www.cnblogs.com/newworldcom/p/4458329.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!