您的位置:首页 > 移动开发 > IOS开发

iOS开发学习笔记 -- (五)关于Table的更多

2013-03-12 14:25 567 查看
原文:http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewStyles/TableViewCharacteristics.html#//apple_ref/doc/uid/TP40007451-CH3-SW1

一、Table的样式

表格主要有两种样式:plain和grouped。

plain的像这样:



一种变形是索引了列表的plain table(a table view configured as an indexed list),如下图所示:



还有作为选择列表的table(可控制单选或多选):



grouped table views

分组的表格视图通常会分为多个section,每个section可能有一个header和footer。以下是一个最常见的例子:



下面这个有header和footer的则看起来相对不太像个table:



下面这个图结合了上面的三种样式,并且给出了数据模型:



(http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewAndDataModel/TableViewAndDataModel.html#//apple_ref/doc/uid/TP40007451-CH5-SW4)

二、单元格的样式(table cell style)

默认的单元格样式由一个title和可选的图片组成,如下图所示:



这种样式对应常量为UITableViewCellStyleDefault

下面这种除了标题外,还有一个副标题:



这种样式对应的常量为:UITableViewCellStyleSubtitle

下面这种样式通常用在显示偏好设置的视图中,它的常量为:
UITableViewCellStyleValue1




下面这种则用在iPhone的通讯录中,主标题在左侧,右对齐;副标题右侧,左对齐,它的常量为:UITableViewCellStyleValue2



Accessory Views(不知道怎么翻译合适,汗。。。),在accessory-type常量中定义

首先解释一下这个Accessory view,看图就明白了,下面是一个table cell:



(原文:http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html#//apple_ref/doc/uid/TP40007451-CH7-SW1)

编辑的时候,变成这样:



(这篇文件讲了如何编辑单元格:http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/ManageInsertDeleteRow/ManageInsertDeleteRow.html#//apple_ref/doc/uid/TP40007451-CH10-SW1)

table有三种accessory view:


UITableViewCellAccessoryDisclosureIndicator,这种用于展示级联的table,即点击后展示下一级的table
view,


UITableViewCellAccessoryDetailDisclosureButton,这种用于展示具体信息


UITableViewCellAccessoryCheckmark,这种用于复选

除了以上的标准的accessory view,其他的可能需要通过自定义一个视图来使用,下面这篇文章介绍了如何定制单元格:
http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html#//apple_ref/doc/uid/TP40007451-CH7-SW1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: