typedef NS_ENUM(NSInteger, UITableViewCellStyle) { UITableViewCellStyleDefault, // Simple cell with text label and optional image view (behavior of UITableViewCell in iPhoneOS 2.x) UITableViewCellStyleValue1, // Left aligned label on left and right aligned label on right with blue text (Used in Settings) UITableViewCellStyleValue2, // Right aligned label on left with blue text and left aligned label on right (Used in Phone/Contacts) UITableViewCellStyleSubtitle // Left aligned label on top and left aligned label on bottom with gray text (Used in iPod). }; // available in iPhone OS 3.0
iPhone提供了4种基本的表格视图单元格,在SDK 3.0 之后,每个单元格都有3个属性textLabel,detailTextLabel和imageView。
下面一一介绍这4种基本格式:
1、UITableViewCellStyleDefault
该格式提供了一个简单的左对齐的文本标签textLabel和一个可选的图像imageView。如果显示图像,那么图像将在最左边。
这种格式虽然可以设置detailTextLabel,但是不会显示该标签。
2、UITableViewCellStyleSubtitle
该格式与前一种相比,增加了对detailTextLabel的支持,该标签将会显示在textLabel标签的下面,字体相对较小。
3、UITableViewCellStyleValue1
该格式居左显示textLabel,居右显示detailTextLabel,且字体较小。
4、UITableViewCellStyleValue2
该格式居左现实一个小型蓝色主标签textLabel,在其右边显示一个小型黑色副标题详细标签detailTextLabel。
该格式不支持图像
个人感觉,格式1和2使用较多,如果这两种不能满足我的要求,那么就采用定制UITableViewCell的方式。
相关推荐
UITableViewCell的四种不同的定制单元格方式
UITableViewCell自定义等高
手写代码自定义UITableViewCell和xib自定义UITableViewCell的DEMO,适合初学者学习。
UITableViewCell动画效果
我们通过代码来探索UITableViewCell重用的实现
利用原始UITableViewcell强大的自适应性能,改造UITableViewcell,与自定义UITableViewcell略有不同
MGSwipeTableCell 一个易于使用的UITableViewCell子类,允许显示具有各种转场效果的可滑动按钮
UITableViewCell 自动调节高度
IOS特定条件上UITABLEVIEWCELL不刷新的现象
优化UITableViewCell滚动性能,使用到Loren Brichter在Twitter中写到得关于UITableViewCell流畅滚动的内容。
NULL 博文链接:https://justsee.iteye.com/blog/2208725
UITableviewCell高度自适应
上篇文章介绍了如何用UITableView显示表格,并讲了几种UITableViewCell的风格。不过有时候我们需要自己定义UITableViewCell的风格,其实就是向行中添加子视图。添加子视图的方法主要有两种:使用代码以及从.xib文件...
Xib设计UITableViewCell然后动态加载例子,对应博客贴子地址: http://blog.csdn.net/duanyipeng/article/details/7259108
UITableView用来以表格的形式显示数据。关于UITableView,我们应该注意: ...(4)所有的UITableView实现时实际上只有一列,但是我们可以通过向UITableViewCell中添加子视图,使得它看起来有好几列。
自定义UITableViewCell。实现各种样式的表格输入界面ios源代码设计资料
前两年IOS应用源码-主要是用于毕业设计学习的。
自定义UITableViewCell
主要介绍了IOS UITableView和UITableViewCell的几种样式详细介绍的相关资料,需要的朋友可以参考下
ios7自定义UITableViewCell