UITableView探索
来源:互联网 发布:阿里云 cdn 免费 编辑:程序博客网 时间:2024/04/29 12:29
在iOS程序中,UITableView得到了广泛的应用。本系列文章将逐步由浅入深的探索UITableView特性。
1.UITableView的类型:
属性:style
@property(nonatomic, readonly) UITableViewStyle style // style为readonly,初始化设置后,不能再改变有两种类型:Plain和Groupedtypedef enum { UITableViewStylePlain, UITableViewStyleGrouped} UITableViewStyle;初始化方法:- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style1.1 UITableViewStylePlain类型简介
spain类型的表格,在屏幕上由上往下连续的展示列表内容。列表可以分为一个或多个组(section),每个section里可以有一个或多个行(row),表格的默认背景色为白色。每个section可以有header和footer,header和footer可以为自定义的View。当表格滚动时,header和footer是悬浮的(float).在表格的右侧,可以添加索引栏(index bar)。当点击索引栏时,表格会滚动到相应的位置。1.2 UITableViewStyleGrouped类型简介
grouped类型的表格,也可以分section,section中有多个row。与spain的不同是,表格明确的由section分开,section是独立的,表格滚动时,section的header和footer也跟着滚动,而不是悬浮。
2.NSIndexPath简介
UITableView、UITableViewDataSource、UITableViewDelegate的许多方法都使用NSIndexPath作为参数或者返回值。以此,iOS SDK中为类NSIndexPath添加了 UITableView分类(Category).
NSIndexPath(UITableView) 有两个参数section、row和一个类方法+ indexPathForRow:inSection:组成。
3.UITableViewDataSource
协议UITableViewDataSoource的方法提供了表格的内容信息。Configuring a Table View
– numberOfSectionsInTableView:
- 表格的组数,不实现,默认为1. 可选
– tableView:numberOfRowsInSection:
required method- 表格每个section中的行数。必需
– tableView:cellForRowAtIndexPath:
required method
– sectionIndexTitlesForTableView:
– tableView:sectionForSectionIndexTitle:atIndex:
– tableView:titleForHeaderInSection:
– tableView:titleForFooterInSection:
Inserting or Deleting Table Rows
– tableView:commitEditingStyle:forRowAtIndexPath:
– tableView:canEditRowAtIndexPath:
Reordering Table Rows
– tableView:canMoveRowAtIndexPath:
– tableView:moveRowAtIndexPath:toIndexPath:
4.UITableViewDelegate
- UITableView探索
- UITableViewCell高度自适应探索--UITableView+FDTemplateLayoutCell(转载)
- UITableView
- UITableView
- UITableView
- UITableView
- UITableView
- UITableView
- UITableView
- UITableView
- UITableview
- UITableView
- UITableView
- UITableView
- UITableView
- UITableView,
- UITableView
- UITableView
- java 网站推荐
- SVN 不是有内部或外部命令,也不是可运行的程序或批处理文件。 Win 7-64位
- HDU 3830 Checkers 2011 Multi-University Training Contest 1 - Host by HNU
- 用dom4j读取xml文档的简单实现
- log4j配置祥解
- UITableView探索
- Weblogic下部署服务遭遇各种问题的解决方案
- AsyncTask类的使用
- struts 实现文件上传与下载
- Inside The C++ Object Model(Note):sizeof in an object
- iphone viewWillAppear not firing
- 忘记了以su模式进入vim编辑器
- 上班第一件事
- 数据结构课程设计总结--学生作业管理系统