使用TableView
2015-04-26 20:46
183 查看
关键代码如下:
import UIKit class MyTV: UITableView ,UITableViewDataSource{ let table_cell=1 var array=["尽子轨","渣渣将","swift"] init(coder aDecoder:NSCoder!){ super.init(coder:aDecoder) self.dataSource=self } init(frame: CGRect) { super.init(frame: frame) // Initialization code } func numberOfSectionsInTableView(tableView: UITableView!) -> Int { return 1 } func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! { var cell : AnyObject!=tableView.dequeueReusableCellWithIdentifier("cell") var label=cell.viewWithTag(table_cell) as UILabel label.text=array[indexPath.row] return cell as UITableViewCell } func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int { return 3 }
相关文章推荐
- iOS学习之Table View的简单使用
- android应用开发之ImageView,SeekBar,TableHost,ProgressBar的使用
- Navigation 与 tableview controller 一起使用
- Swift - 使用TableView的静态单元格进行页面布局
- 封装tableView、collectView,简化使用
- 使用UIAlertView和UITableView来创建一个有用的UIAlertTableView
- tableView使用MJRefresh视图下滑64,下拉UI显示
- 纯代码实现QQ聊天界面---TableView使用详解
- 自定义Table View Cell左右滑动的使用
- [第1章]界面:Table View Controller的使用
- scrollview和tableview混合使用
- iOS开发 自定义tableView样式(使用代码/使用Interface Builder)、分组显示、给TableView增加索引、给TableView增加SearchBar
- 使用TableView时,头部空出20像素的解决办法
- TableView使用及优化
- Static TableView 使用问题
- iOS学习之分段Table View的使用(Grouped样式表格)
- 关于设置 UITableView 的 tableHeaderView为使用了 SnapKit 约束的自定义 view 时出现的 BUG 的处理
- IOS8,使用storyBoard对tableView的自适应
- TableView的使用
- TableView 使用时的一个异常