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

原文: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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值