UITableViewCell - 4种显示格式
2016-01-06 13:22
447 查看
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的方式。
相关文章推荐
- iOS开发中UITableview控件的基本使用及性能优化方法
- 详解iOS开发中UItableview控件的数据刷新功能的实现
- UITableView 实现汽车品牌(demo)
- IOS 9 UITableView整理
- UITableView 基本使用方法总结
- UITableView一些易混属性和方法
- UITableView的详细讲解
- (转)UITableViewController重要配置方法和Delegate
- UITableView详细用法,UITableView指南,UITableView详细教程
- ios隐藏uitableview下面多余的tableview的线条
- 定制UITableViewCell的事件响应处理
- ios关于tableView的重用
- UITableView Plain下的section取消顶部粘连
- IOS UITableView 实现LOL数据展示
- iOS开发之UITableView多选
- iOS- UITableView
- 仿QQ控件图片下拉放大效果
- 关于UITableView的简单使用
- QQ分组
- 关于SearchaBar的bookMarks(代理方式实现)