今天要分享的是IOS开发中一个使用率非常高的一个控件-------UITableView,这两天正在使用tableview做信息的显示,在写代码时对tableview和tableviewcell的几种样式一直分不清楚,今天我详细的研究了一下,下面就跟大家分享一下:

一、系统自己的UITableView样式有两种:

1.UITableViewStylePlain:

[img]http://dl2.iteye.com/upload/attachment/0116/9810/6c3333a9-5396-387d-93a8-9ce1d9cc7f38.png[/img]

Plain样式的是方形的,充满你给的view.frame坐标。

2.UITableViewStyleGrouped:

[img]http://dl2.iteye.com/upload/attachment/0116/9812/b63d20c5-d86c-3eea-8b21-139c239a7012.png[/img]

Grouped样式主要是以圆角形显示。跟iphone自带的通讯录编辑页面类似。


二、系统自己的UITableViewCell样式有四种:

1.UITableViewCellStyleDefault:

[img]http://dl2.iteye.com/upload/attachment/0116/9814/788a24c9-62e5-3c30-ac4e-0f825ecbde27.png[/img]

Default样式:左边一个显示图片的imageView,一个标题textLabel,没有detailTextLabel。

2.UITableViewCellStyleSubtitle:

[img]http://dl2.iteye.com/upload/attachment/0116/9816/cdf6f8d5-0c74-3910-a85e-7141d3937005.png[/img]

Subtitle样式:左边一个显示图片的imageView,上边一个主标题textLabel,一个副标题detailTextLabel。主标题字体大且加黑,副标题字体小在主标题下边。

3.UITableViewCellStyleValue1:

[img]http://dl2.iteye.com/upload/attachment/0116/9818/a6d23b3c-1824-306a-b789-e721cd179278.png[/img]

Value1样式:左边一个显示图片的imageView,左边一个主标题textLabel,右边一个副标题detailTextLabel,主标题字体比较黑。

4.UITableViewCellStyleValue2:

[img]http://dl2.iteye.com/upload/attachment/0116/9820/9059aed3-20db-354a-a41c-1e4514dfa338.png[/img]

Value2样式:左边一个主标题textLabel字体偏小,挨着右边一个副标题detailTextLabel,字体大且加黑。

That‘s all,Thank you for support。